Spire.XLS is a professional Excel .NET library that can be used to any type of .NET( C#, VB.NET, ASP.NET, .NET Core) application and Java (J2SE and J2EE) application.

Mon Apr 05, 2021 7:38 am

Getting below exception for below code

Workbook workbook = new Workbook();
//Initialize worksheet
Worksheet sheet = workbook.Worksheets[0];
//Append text
//sheet.Range["A1"].Text = "Demo: Save Excel in .NET";

sheet.InsertDataTable(dt, true, 1, 1, -1, -1);


Unhandled Exception: spr?: CT39String length max than 32K.

arun_jp97
 
Posts: 1
Joined: Mon Apr 05, 2021 7:31 am

Mon Apr 05, 2021 10:05 am

Hello,

Thanks for your inquiry!

I simulated a data table and tested your code with the latest Spire.Xls V11.3.4 but did not reproduce your issue.

If you were not using the latest version, I recommend that you have a try.

If the issue still exists, I guess the issue may be caused by the length of the data in your data table. To help us reproduce your issue, please provide us with the data of your data table (you can export them to a txt file refer to the following code), your system information (E.g. Win7, 64 bit) and region setting (E.g. China, Chinese) for reference.

Thanks in advance.

Code: Select all
            StringBuilder builder = new StringBuilder();
            foreach(DataColumn column in dt.Columns)
            {
                builder.Append(column.ColumnName + "\t");
            }

            foreach(DataRow row in dt.Rows)
            {
                builder.Append("\r\n");
                for (int i =0; i < dt.Columns.Count; i++)
                {
                    builder.Append(row[i].ToString()+"\t");
                }
            }
            File.WriteAllText("datatable.txt", builder.ToString());


Sincerely,
Marcia
E-iceblue support team
User avatar

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

Wed Apr 21, 2021 8:59 am

Hello,

Hope you are doing well!

How is the issue now? If it still exists, could you please provide the above information to us for further investigation?

Thanks in advance.

Sincerely,
Marcia
E-iceblue support team
User avatar

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

Return to Spire.XLS