@iimm/word-excel-unprotect
v0.0.1
Published
remove editting restrictions of the word or excel file. 移除Word/Excel文件的限制编辑
Readme
@iimm/word-excel-unprotect
Description
一个简单的React组件,在纯浏览器环境中解除Word或Excel文件的编辑限制(如果设置了打开文件就需要输入密码则不可以)
a simple React component to unprotect Word or Excel files in pure browser environment. while if the password is required when a file is opened, it cannot be unprotected.
Preview
Install
# pnpm
$ pnpm add @iimm/word-excel-unprotect
# npm
$ npm i @iimm/word-excel-unprotect
# yarn
$ yarn add @iimm/word-excel-unprotectProps
export let wordOrExcelUnprotectTranslations = {
reset: {
zh: "重置",
en: "Reset",
},
unprotect: {
zh: "解除限制",
en: "Unprotect",
},
extentionCheckMsg: {
zh: `不是支持的docx或xlsx文件格式,请另存为(直接修改扩展名无效)支持的格式:`,
en: `Not a supported docx or xlsx file format, please save as (modifying the extension name directly is invalid) supported formats: `,
},
magicNumberCheckMsg: {
zh: "文件魔数检查:不是有效的docx或xlsx文件",
en: "File magic number check: not a valid docx or xlsx file",
},
xmlCheckMsg: {
zh: "文件结构检查:不是有效的docx或xlsx文件",
en: "File structure check: not a valid docx or xlsx file",
},
unknownErrorMsg: {
zh: "未知错误",
en: "Unknown error",
},
noEdittingRestrictionMsg: {
zh: "原文件没有限制编辑",
en: "The original file does not have any editing restrictions",
},
};
interface WordOrExcelUnprotectProps {
className?: string;
/**
* @default 'zh'
*/
lang?: ("zh" | "en") & {};
translations?: Record<keyof typeof wordOrExcelUnprotectTranslations, Record<string, string>>;
/**
* @default 'iimm-'
*/
fileNamePrefix?: string;
}Styles
.iimm-unprotect-container {
width: 100%;
padding: 5px;
}
.iimm-unprotect-input {
padding: 5px;
}
.iimm-unprotect-error {
color: red;
font-weight: bold;
margin-top: 5px;
margin-bottom: 5px;
}
.iimm-unprotect-reset {
margin-left: 5px;
margin-right: 5px;
background: transparent;
border-color: #9254de;
border-radius: 5px;
min-width: 15px;
min-height: 10px;
color: #722ed1;
cursor: pointer;
}
.iimm-unprotect-action {
margin-left: 5px;
margin-right: 5px;
background: #1890ff;
border-color: #1890ff;
border-radius: 5px;
min-width: 25px;
min-height: 10px;
color: white;
cursor: pointer;
}
LICENSE
MIT
