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.

Fri Feb 03, 2017 8:29 pm

Could you please give me a detailed description on InsertOptionsType? There are three options under it: InsertOptionsType.FormatAsAfter
InsertOptionsType.FormatAsBefore
InsertOptionsType.Default

What does each of them mean?

Thanks,
Lucy

lsong
 
Posts: 36
Joined: Wed Feb 01, 2017 4:13 pm

Sat Feb 04, 2017 3:27 am

Dear Lucy,

Thanks for your inquiry.
They are parameters of WorkSheet.InsertRow(int rowIndex, int rowCount, InsertOptionsType insertOptions); method. InsertOptionsType will appoint the format of the insert row while using the method to insert a row or rows. For example:

1) sheet.InsertRow(2, 1, InsertOptionsType.FormatAsBefore); will insert a new row between row 1 and row 2 and copy the format of row 1 to the new row.
2) sheet.InsertRow(2, 1, InsertOptionsType.FormatAsAfter); will copy the format of row 2 to the insert row.
3) sheet.InsertRow(2, 1, InsertOptionsType.FormatDefault); will load the default format to the insert row. It's the same as sheet.InsertRow(2, 1);.

Any further questions, please contact us.
Have a nice day.

Sincerely,
Simon
E-iceblue support team
User avatar

Simon.yang
 
Posts: 620
Joined: Wed Jan 11, 2017 2:03 am

Mon Feb 06, 2017 2:49 pm

Thanks for your reply! I have an additional question. After I use sheet.InsertRow(2, 1, InsertOptionsType.FormatDefault) to insert a new row. The format type for each column looks right at first place, but after I inserted data into each row, for example, there is a column which data type is datetime, if a row with datetime value as none is inserted, the format type of that column changes to "General" after the insertion. For rows which have a valid datetime value, the format type stays the same as before the insertion. We need the format type to remain the same no matter what. In our case, It should stay with "Datetime", not change to "Genaral" after insertion with no data. Do you know how to fix that?

lsong
 
Posts: 36
Joined: Wed Feb 01, 2017 4:13 pm

Tue Feb 07, 2017 2:41 am

Hi Lucy,

You should use sheet.InsertRow(2,1,InsertOptionsType.FormatAsAfter) or sheet.InsertRow(2,1,InsertOptionsType.FormatAsBefore) to keep the new row format stay with "Datetime". If you change the property into InsertOptionsType.FormatDefault the format of new row will turn into "Genaral". If I misunderstand, please provide us the sample file and related code to do a better investigation.
Any questions, please contact us.

Sincerely,
Simon
E-iceblue support team
User avatar

Simon.yang
 
Posts: 620
Joined: Wed Jan 11, 2017 2:03 am

Tue Feb 07, 2017 10:10 pm

I am working on a project which needs to create a report from a template, then add data from a XMl file and insert into each row of the report. Here is a code snippet:

my problem is: I need to create each new row based on the style in template. For instance, I have some row which is wrapped text in template, but when I run the above code, the wrapped text check always returns false. So when I generate the report, the wrapped text cell is truncated. How do I apply the style from the template to each row I inserted into the report?
Last edited by lsong on Thu Feb 09, 2017 3:31 pm, edited 1 time in total.

lsong
 
Posts: 36
Joined: Wed Feb 01, 2017 4:13 pm

Wed Feb 08, 2017 10:15 am

Hello,

Thanks for your reply.
We will investigate the issue and update to you ASAP.

Sincerely,
Simon
E-iceblue support team
User avatar

Simon.yang
 
Posts: 620
Joined: Wed Jan 11, 2017 2:03 am

Wed Feb 08, 2017 9:24 pm

Attached are two screenshots which will provide you more information on this issue. One is called "Correct" which demonstrated how the report should look like. The other is called "Wrong" which is generated from my code. You can see the columns with wrapped text didn't display correctly. For cells which should be wrapped text, I checked "isWrappedText" flag at run time and they all set to true. Looks like the template is applied correctly. But don't know why they are not displayed correctly.
Last edited by lsong on Thu Feb 09, 2017 3:30 pm, edited 1 time in total.

lsong
 
Posts: 36
Joined: Wed Feb 01, 2017 4:13 pm

Thu Feb 09, 2017 10:09 am

Hello,

Thanks for your documents.
It would be great if you please share the sample documents for investigation purposes.

Sincerely,
Simon
E-iceblue support team
User avatar

Simon.yang
 
Posts: 620
Joined: Wed Jan 11, 2017 2:03 am

Mon Feb 13, 2017 7:11 am

Hi Lucy,

How is the issue going? Please give us some feedback at your convenience. If the issue still exists, please provide us the template documents for further investigation. You could send the files to us(support@e-iceblue.com) via email. We promise to keep it confidential and won't use it for any other purpose.

Sincerely,
Simon
E-iceblue support team
User avatar

Simon.yang
 
Posts: 620
Joined: Wed Jan 11, 2017 2:03 am

Return to Spire.XLS