Skip to content

Commit

Permalink
fix: excel 布尔值展示错误
Browse files Browse the repository at this point in the history
  • Loading branch information
501351981 committed Nov 10, 2023
1 parent 685c002 commit 7695535
Show file tree
Hide file tree
Showing 18 changed files with 340 additions and 7 deletions.
2 changes: 1 addition & 1 deletion core/packages/js-excel/package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "@js-preview/excel",
"type" :"module",
"version": "1.4.5",
"version": "1.4.6",
"description": "",
"main": "lib/index.js",
"files": [
Expand Down
2 changes: 1 addition & 1 deletion core/packages/vue-excel/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@vue-office/excel",
"version": "1.4.5",
"version": "1.4.6",
"description": "",
"main": "lib/index.js",
"files": [
Expand Down
13 changes: 11 additions & 2 deletions core/packages/vue-excel/src/excel.js
Original file line number Diff line number Diff line change
Expand Up @@ -163,6 +163,13 @@ function getCellText(cell){
return value * 100 + '%';
}
}else if(/0(\.0+)?/.test(cell.style.numFmt)){
let prefix = '';
if(cell.style.numFmt.startsWith('$')){
prefix = '$';
}else if(cell.style.numFmt.startsWith('"¥')){
prefix = '¥';
}

if(value === 0 && cell.style.numFmt.startsWith('_')){
return '-';
}
Expand All @@ -189,7 +196,7 @@ function getCellText(cell){
result[0] = newNumber.reverse().join('');
result = result.join('.');
}
return result;
return prefix + result;
}

}
Expand Down Expand Up @@ -225,6 +232,8 @@ function getCellText(cell){
return get(value, 'result.error') || value.result;
case 8: //富文本
return cell.text;
case 9: //Boolean
return cell.text.toUpperCase();
default:
return value;
}
Expand Down Expand Up @@ -344,7 +353,7 @@ function getStyle(cell){

export function transferExcelToSpreadSheet(workbook, options){
let workbookData = [];
// console.log(workbook, 'workbook');
console.log(workbook, 'workbook');
let sheets = [];
workbook.eachSheet((sheet) => {
sheets.push(sheet);
Expand Down
2 changes: 1 addition & 1 deletion core/packages/vue-pdf/index.d.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
declare const VueOfficePdf: {
install?: (vue: any) => void;
src: string|ArrayBuffer|Blob;
rerender: () => any;
rerender?: () => any;
staticFileUrl?: string,
requestOptions?: any;
options?: any
Expand Down
2 changes: 1 addition & 1 deletion core/packages/vue-pdf/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@vue-office/pdf",
"version": "1.5.4",
"version": "1.5.5",
"description": "",
"main": "lib/index.js",
"files": [
Expand Down
1 change: 1 addition & 0 deletions examples/dist/assets/DocxDemo-ff7579be.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions examples/dist/assets/ExcelDemo-cc5fdc46.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions examples/dist/assets/JsDocxDemo-72182715.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions examples/dist/assets/JsExcelDemo-e79b4fd7.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions examples/dist/assets/JsPdfDemo-880a432c.js

Large diffs are not rendered by default.

1 change: 1 addition & 0 deletions examples/dist/assets/PdfDemo-4ea131d4.js

Large diffs are not rendered by default.

1 change: 1 addition & 0 deletions examples/dist/assets/PreviewWrapper-b14e5680.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading

0 comments on commit 7695535

Please sign in to comment.