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

分批次导入同一个Sheet该怎么操作? #579

Open
Ha-cyber opened this issue Oct 15, 2024 · 0 comments
Open

分批次导入同一个Sheet该怎么操作? #579

Ha-cyber opened this issue Oct 15, 2024 · 0 comments

Comments

@Ha-cyber
Copy link

我试图使用excelExporter.Append().SeparateByRow() 但在循环中
for (int i = 1; i <= writeCount; i++)
{
searchModel.Current = i;
var ms = GetData(searchModel, exportSettingModel.SelectDataSql);
var ms3 = ms.Copy();
if(i==1)
excelExporter=excelExporter.Append(ms);
else
{

                excelExporter=excelExporter.SeparateByRow().Append(ms3);
            }

        }
        ShiftTabelModel我标记了 [ExcelExporter(Name = "测试",AutoFitAllColumn = true, MaxRowNumberOnASheet = 10002)]
        会报错ExportShit导出Error:Value cannot be null. (Parameter 'A sheet with the name already exists:测试')
        使用excelExporter.Append(ms).SeparateByRow().Append(ms3); 同上也会报错
        ExportShit导出Error:Value cannot be null. (Parameter 'A sheet with the name already exists:测试')   at Magicodes.ExporterAndImporter.Excel.ExcelExporter.Append[T](ICollection`1 dataItems, String sheee)
        如果改为每次都是不同的sheet就可以
         for (int i = 1; i <= writeCount; i++)
        {
            searchModel.Current = i;
            var ms = GetData<ShiftTabelModel>(searchModel, exportSettingModel.SelectDataSql);
            var ms3 = ms.Copy();
            if(i==1)
                excelExporter=excelExporter.Append(ms,"sheet");
            else
            {
                
                excelExporter=excelExporter.SeparateByRow().Append(ms3,$"sheet{i}");
            }

        }
        1.是否是bug或我设置不对 
        2.希望后续可以出一个按行来追加的时候可以新增配置选择表头或忽略表头而不是展示空白行
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

No branches or pull requests

3 participants
@Ha-cyber and others