excel icon indicating copy to clipboard operation
excel copied to clipboard

insert Row/Column deletes everything

Open Kuromory opened this issue 3 years ago • 4 comments

Hey if I have an excel sheet with say 50 rows and I user the function sheet.insertRow(33) everything after that is deleted... Same problem with Column.

I hope you have soon a fix for it :)

also dunno if it is bc of the insertRow but my excel always get currupted... it is the file format .xlsm maybe that is not supported?

Kuromory avatar Jul 31 '22 22:07 Kuromory

Hi, is there any update here? I have the same problem.

When I use insertRow(n), all data after row n was gone. Only leave rors at row [0, n-1] and empty row at row n.

Env

  1. windows x64 app (dev mode)
  2. flutter 3.10.1
  3. excel 2.1.0

Thanks.

Lyqqt avatar Jul 07 '23 10:07 Lyqqt

Is this still reproducible on 3.0.0? Can you provide an example excel file and sample code which yield the error?

FauconSpartiate avatar Oct 28 '23 07:10 FauconSpartiate

Hello @FauconSpartiate ,

This is still reproducible on 4.0.2.

I'm attaching 2 Excel files for reference: MBFin-original is the original file with 15 lines. MBFin is the final product after I run the code below, it shrunk to only 6 lines.

Here's my code for reference as well:

                  var sheet = financesExcel.tables['Transactions'];
                  var newRowIndex = 5;
                  sheet!.insertRow(newRowIndex);
                  sheet.cell(CellIndex.indexByColumnRow(
                      columnIndex: 0, rowIndex: newRowIndex))
                    ..value = const DateCellValue(year: 2024, month: 2, day: 15)
                    ..cellStyle =
                        CellStyle(numberFormat: NumFormat.defaultDate);

                  sheet
                      .cell(CellIndex.indexByColumnRow(
                          columnIndex: 1, rowIndex: newRowIndex))
                      .value = const TextCellValue("CLEARED");

                  sheet
                      .cell(CellIndex.indexByColumnRow(
                          columnIndex: 2, rowIndex: newRowIndex))
                      .value = const TextCellValue("New Payee");

                  sheet
                      .cell(CellIndex.indexByColumnRow(
                          columnIndex: 3, rowIndex: newRowIndex))
                      .value = const TextCellValue("Category");

                  sheet
                      .cell(CellIndex.indexByColumnRow(
                          columnIndex: 4, rowIndex: newRowIndex))
                      .value = const TextCellValue("Tags");

                  sheet.cell(CellIndex.indexByColumnRow(
                      columnIndex: 5, rowIndex: newRowIndex))
                    ..value = const DoubleCellValue(-999.99)
                    ..cellStyle =
                        CellStyle(numberFormat: NumFormat.defaultNumeric);

                  List<int>? fileBytes = financesExcel.save();

FinDB.xlsx FinDB-original.xlsx

P.S.: Not sure if important, but I'm not storing this Excel file locally. I'm using library flutter_onedrive to download the Excel file, work on it locally with excel, and then Upload it back to One Drive.

This is an Android app.

Let me know if I missed anything else that might help reproduce the issue.

markborges avatar Feb 15 '24 06:02 markborges

Hi, is there any update here? I have the same problem.

AlaJaber97 avatar Apr 24 '24 12:04 AlaJaber97