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: 858
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: 858
Joined: Wed Nov 04, 2020 2:29 am

Fri Oct 15, 2021 6:54 am

Hi, I have the same issue.

my code is :

Code: Select all
Workbook workbook = new Workbook();
workbook.LoadFromFile("test.001.csv", "\t", 1, 1, ExcelVersion.Version97to2003, Encoding.UTF8);


If I delete some rows, this issue is not exist.
Last edited by sesamefly on Mon Oct 18, 2021 7:53 am, edited 1 time in total.

sesamefly
 
Posts: 6
Joined: Fri Oct 15, 2021 6:47 am

Fri Oct 15, 2021 9:03 am

Hello zhinan,

Thanks for your inquiry.
I have duplicated your issue and logged it in our issue tracking system with the ticket SPIREXLS-3492. I will inform you once there is any update.
By the way, we also provide Chinese technical support, next time you can contact us in Chinese directly if you want.

Sincerely,
Amy
E-iceblue support team
User avatar

amy.zhao
 
Posts: 2662
Joined: Wed Jun 27, 2012 8:50 am

Fri Oct 15, 2021 9:31 am

好的。上次提交的附件为 xls 格式,忘记修改格式了,实际中使用的是 csv 格式。您可以自行修改附件的后缀为 csv 即可。

sesamefly
 
Posts: 6
Joined: Fri Oct 15, 2021 6:47 am

Fri Oct 15, 2021 9:41 am

感谢您的提示,我测试问题时已修改为.csv。

祝生活愉快!
Amy
E-iceblue support team
User avatar

amy.zhao
 
Posts: 2662
Joined: Wed Jun 27, 2012 8:50 am

Mon Oct 18, 2021 1:57 am

您好。复现问题了么。大概要多久能修复这个问题哈,或者该如何自己解决是否能给些建议?在线等,挺急的 :mrgreen:

sesamefly
 
Posts: 6
Joined: Fri Oct 15, 2021 6:47 am

Mon Oct 18, 2021 2:36 am

您好,

您的问题我复现了的,已记录到我们的问题跟踪系统,问题编号为SPIREXLS-3492。 开发人员已反馈此问题的原因,在您的数据中存在双引号没有正确闭合的问题,比如在第375行数据中,只有一个前引号,在此行没有对应的闭合双引号,程序就会去找下面行数据中的双引号,引起了一个数据跨多行,拼成了一个庞大的数据长度。
sourceData.png
sourceData.png (3.33 KiB) Viewed 1852 times

因此,建议您请修正下双引号的起始点,这样文档就可以正确读取了。


Amy
E-iceblue support team
User avatar

amy.zhao
 
Posts: 2662
Joined: Wed Jun 27, 2012 8:50 am

Mon Oct 18, 2021 6:21 am

好的,我试下。这个是别人提供的文件。。。

sesamefly
 
Posts: 6
Joined: Fri Oct 15, 2021 6:47 am

Mon Oct 18, 2021 6:36 am

好的,有任何问题,请联系我们。

Amy
E-iceblue support team
User avatar

amy.zhao
 
Posts: 2662
Joined: Wed Jun 27, 2012 8:50 am

Mon Oct 18, 2021 7:51 am

您好。
处理过双引号和其他特殊字符后,可以正常加载文件了。
PS:但是遇到另外一个问题,另存为 XLS 格式时,只能保存 200 行。是因为使用的是 Free 版本嘛,我的版本是 "FreeSpire.XLS" Version="11.8.6"

sesamefly
 
Posts: 6
Joined: Fri Oct 15, 2021 6:47 am

Mon Oct 18, 2021 8:35 am

您好,

感谢反馈您之前问题已经解决了。
是的, 只有免费版本才有200行的限制。商业版本是没有任何限制的。建议您下载我们的商业版本(https://www.e-iceblue.cn/Downloads/Spire-XLS-NET.html)进行测试,我们可以提供您一个月的免费授权以便更完整的试用我们的产品。请告知您是否需要一个月的免费授权。谢谢!

Amy
E-iceblue support team
User avatar

amy.zhao
 
Posts: 2662
Joined: Wed Jun 27, 2012 8:50 am

Tue Oct 19, 2021 1:55 am

恩,谢谢支持。昨天下午自己写了需要的功能,暂时用不到其他高阶功能,暂时不需要试用。再次感谢!

sesamefly
 
Posts: 6
Joined: Fri Oct 15, 2021 6:47 am

Tue Oct 19, 2021 2:35 am

不客气,后期使用我们产品遇到问题或需要帮助时,请再联系我们。

祝工作和生活愉快!

Amy
E-iceblue support team
User avatar

amy.zhao
 
Posts: 2662
Joined: Wed Jun 27, 2012 8:50 am

Return to Spire.XLS