Spire.XLS is a professional Excel API that enables developers to create, manage, manipulate, convert and print Excel worksheets. Get free and professional technical support for Spire.XLS for .NET, Java, Android, C++, Python.

Mon Nov 29, 2021 11:06 pm

I am creating a new workbook, and inserting the column names using the InsertArray method.
After that I am getting some data from a database, and using the same InsertArray method to insert the data in the worksheet. This data has some empty ( like this: "") elements.

When I am saving the Workbook to a file, all the empty data is replaced by the value of the cell A1. (Please, see the code I am using, and the screenshot).

It looks like the file generation replaces the empty cells with the cell A1 value.

How can I solve this problem?

Thanks!!
Code: Select all
ReportOutputFile = new Workbook();
ReportOutputFile.Worksheets[0].Name = "New name";
string[] columnTitles = new string[]
                {
                    "Column 1",
                    "Column 2",
                    "Column 3",
                    "Column 4",
                    "Column 5",
                    "Column 6",
                    "Column 7",
                    "Column 8",
                    "Column 9",
                    "Column 10",
                    "Column 11",
                    "Column 12",
                    "Column 13",
                    "Column 14",
                    "Column 15",
                    "Column 16",
                    "Column 17",
                    "Column 18",
                    "Column 19",
                    "Column 20",
                    "Column 21",
                    "Column 22",
                    "Column 23",
                    "Column 24",
                    "Column 25",
                    "Column 26",
                    "Column 27",
                    "Column 28",
                    "Column 29",
                    "Column 30"
                };
                ReportOutputFile.Worksheets[0].InsertArray(columnTitles, 1, 1, false);
                List<DataModel> datalList = dbConnection.GetData();
                var line = 2;
                datalList.ForEach(_ =>
                {
                    ReportOutputFile.Worksheets[0].InsertArray(_.ToArray(), line, 1, false); //Some elements of the list have empty values for some properties
                    line++;
                });
                ReportOutputFile.SaveToFile("Sources/ReportOutputFile.xls", ExcelVersion.Version97to2003);


CaptureFinalFIle.PNG
The saved file.
CaptureFinalFIle.PNG (32.06 KiB) Viewed 657 times

mlordelo
 
Posts: 3
Joined: Mon Nov 29, 2021 10:44 pm

Tue Nov 30, 2021 5:46 am

Hello,

Thanks for your inquiry!

I have reproduced your issue and logged it in our issue tracking system with the ticket SPIREXLS-3562 for further investigation.

We will let you know if there is any update. Sorry for the inconvenience caused.

Sincerely,
Marcia
E-iceblue support team
User avatar

Marcia.Zhou
 
Posts: 858
Joined: Wed Nov 04, 2020 2:29 am

Mon Dec 06, 2021 8:26 am

I too am experiencing this problem and would be grateful for a fix.

Do you have any idea when a new/patched version will be available please?

Thanks
Mark

Marcia.Zhou wrote:Hello,

Thanks for your inquiry!

I have reproduced your issue and logged it in our issue tracking system with the ticket SPIREXLS-3562 for further investigation.

We will let you know if there is any update. Sorry for the inconvenience caused.

Sincerely,
Marcia
E-iceblue support team

alandaspain
 
Posts: 2
Joined: Mon Jan 13, 2020 6:57 am

Mon Dec 06, 2021 9:44 am

Hello Mark,

Thanks for your following-up!

I just checked the status of your issue and found that it has been resolved. Now it is in the testing phase, once it passes the test, we will inform you ASAP.

Sincerely,
Marcia
E-iceblue support team
User avatar

Marcia.Zhou
 
Posts: 858
Joined: Wed Nov 04, 2020 2:29 am

Thu Dec 09, 2021 1:53 pm

Hello!

Marcia.Zhou wrote:Hello Mark,

Thanks for your following-up!

I just checked the status of your issue and found that it has been resolved. Now it is in the testing phase, once it passes the test, we will inform you ASAP.

Sincerely,
Marcia
E-iceblue support team


Marcia, thanks for the update on this issue.

Mark, I found a workaround for this problem: If you change all empty values ( "" ) to blank space (" "), the file generation doesn't replace the values.

Thanks,
Márcio Lordelo.

mlordelo
 
Posts: 3
Joined: Mon Nov 29, 2021 10:44 pm

Thu Dec 09, 2021 8:12 pm

Thanks for the work-around Márcio.

I really appreciate you passing the information on.

Kind regards

Mark

alandaspain
 
Posts: 2
Joined: Mon Jan 13, 2020 6:57 am

Fri Dec 17, 2021 7:56 am

Hello all!

Glad to inform you that we just released Spire.XLS Pack(Hotfix) Version:11.12.2 which fixes the issue of SPIREXLS-3562.

Please download the fix version from the following links to test.

Website link: https://www.e-iceblue.com/Download/download-excel-for-net-now.html
Nuget link: https://www.nuget.org/packages/Spire.XLS/11.12.2

Sincerely,
Marcia
E-iceblue support team
User avatar

Marcia.Zhou
 
Posts: 858
Joined: Wed Nov 04, 2020 2:29 am

Wed Dec 22, 2021 9:25 am

Hello,

Hope you are doing well!

Has the issue been solved now? Could you please give us some feedback at your convenience?

Thanks in advance.

Sincerely,
Marcia
E-iceblue support team
User avatar

Marcia.Zhou
 
Posts: 858
Joined: Wed Nov 04, 2020 2:29 am

Return to Spire.XLS