Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

options #108

Open
wants to merge 3 commits into
base: master
Choose a base branch
from
Open

options #108

wants to merge 3 commits into from

Conversation

bistuly
Copy link

@bistuly bistuly commented Aug 5, 2023

1、options增加minRowLength (有minColLength 但没有minRowLength 说不过去吧)
2、options增加filterRows、filterCols、函数,过滤出想要显示的行和列
3、options的widthOffset、heightOffset 也可以是函数(特定的行列的宽高偏移值可能不同)
4、options增加getCellText,(内置的getCellText函数考虑的情况不足应对所有情况)

2、options增加filterRows、filterCols、函数,过滤出想要显示的行和列
3、options的widthOffset、heightOffset 也可以是函数(特定的行列的宽高偏移值可能不同)
4、options增加getCellText,(内置的getCellText函数考虑的情况不足应对所有情况)
@@ -318,14 +352,17 @@ export function transferExcelToSpreadSheet(workbook, options){

transferColumns(sheet,sheetData, options);
// 遍历行
(sheet._rows || []).forEach((row,spreadSheetRowIndex) =>{
//(sheet._rows || []).forEach((row,spreadSheetRowIndex) =>{
const rowsNewT = filter_with(sheet._rows || [], options.filterRows);
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

filterRows的作用是什么,过滤之后后续数据如何处理

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

比如①一个excel文件有100行和100列,但只想预览 第10-20行,第30-40列的内容。
②一个excel文件有内容的行只有10行10列,但exceljs在读取这个文件时,却返回了几万列。
filterRows和filterCols用于从exceljs读取后的行列中取出只想预览的那些行列。

@501351981
Copy link
Owner

感觉有的地方不是很理想:

1、options增加minRowLength (有minColLength 但没有minRowLength 说不过去吧) --- 较合理
2、options增加filterRows、filterCols、函数,过滤出想要显示的行和列 --- 感觉必要性不大,既然预览,应该是尽可能的保真展示
3、options的widthOffset、heightOffset 也可以是函数(特定的行列的宽高偏移值可能不同)--- 较合理
4、options增加getCellText,(内置的getCellText函数考虑的情况不足应对所有情况) --- 看起来可以,但是实际如果这么用的话,使用者要进行各种繁琐的处理,估计一般人搞不定,咱们这个库本来就是给小白用户用的

@bistuly
Copy link
Author

bistuly commented Aug 25, 2023

4、options增加getCellText,(内置的getCellText函数考虑的情况不足应对所有情况) --- 看起来可以,但是实际如果这么用的话,使用者要进行各种繁琐的处理,估计一般人搞不定,咱们这个库本来就是给小白用户用的
---内置的getCellText函数考虑的情况不足应对所有情况(目前内置的getCellText函数都还有很多case没考虑,而且最后返回的是cell.value,可能导致界面上显示'[object]'),如果发生了这种情况,前端程序员能使用自定义getcellText函数。对于小白用户,因为options.getCellText是可选项,只有设置了options.getCellText为一个函数时才会起作用,小白用户使用默认的配置options.getCellText留空,就使用的是内置的getCellText)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants