Formatting table rows

Technical support for Spire.Doc

Moderator: iceblue support

Formatting table rows

Postby schmerling » Fri Sep 14, 2012 12:16 pm

I have two problems formatting new table rows.

1. Is there a possibility to set the row height automatically to the height of it's contents? Or how would you compute the height of the contents?
2. Using table.AddRow(true, true) method multiple times to add multiple rows, the first row is ok. But all cells of every following rows doesn't have the right-padding. Setting the right-padding programmatically (tableCell.CellFormat.Paddings.Right = 0.19f;) fails because of System.NullReferenceException (the property Padding is null and cannot be assigned directly).

Thank you.
schmerling
 
Posts: 3
Joined: Wed Aug 01, 2012 10:00 am

Re: Formatting table rows

Postby amy.zhao » Mon Sep 17, 2012 11:09 am

Dear Schmerling,

Thanks for your inquiry.
#1, If you just save the Document object to a doc file, without converting to other format file, we will not compute the height of the row of the content. If you set the height of the row in your code, we just save it to the doc file. If you did not set the height, the row will has no data of height.
#2, We did not understand completely your problem and we can reproduce it, would you please send us your code to help us reproduce you problem, and then we will fix it as soon as possible.

Thanks and Regards,
Amy
e-iceblue support
User avatar
amy.zhao
 
Posts: 2277
Joined: Wed Jun 27, 2012 8:50 am

Re: Formatting table rows

Postby schmerling » Mon Sep 17, 2012 2:34 pm

Dear Amy,

Thank you very much for your answer. Today I tried to recreate the table within my original doc file and executing my code suddenly my problem #1 was gone.

#2, I found another solution: I added some more columns to the table and set the width to the value the right-padding would have to be.
To reproduce the problem:
1. Create a word-document, insert table with 3 columns, check if the table has paddings defined, save document as doc (Word 97-2003).
2. Write code user Spire.Doc to open document, add some new rows to the table, in last column write numeric values and set horizontal alignment to right, save document.
3. Open document using MS-Word. You will see that the right-padding was removed from table-formatting.

Best regards,
Peter
schmerling
 
Posts: 3
Joined: Wed Aug 01, 2012 10:00 am

Re: Formatting table rows

Postby amy.zhao » Tue Sep 18, 2012 7:16 am

Dear Peter,

About #2, we have done a test according to your steps, but we don't reproduce your problem, we provide you the test demo. If we miss something, please tell us or provide us your sample code and documents. So that we can reproduce your problem and solve it quickly. Thanks.

Thanks and Regards,
Amy
e-iceblue support
You do not have the required permissions to view the files attached to this post.
User avatar
amy.zhao
 
Posts: 2277
Joined: Wed Jun 27, 2012 8:50 am

Re: Formatting table rows

Postby schmerling » Tue Sep 18, 2012 12:44 pm

Really strange: Your demo works indeed. So I recreated my source document from scratch and now it works with that document, too.
So I think my original source document was damaged somehow.

Thank you very much for investigating and your demo.

Best regards,
Peter
schmerling
 
Posts: 3
Joined: Wed Aug 01, 2012 10:00 am

Re: Formatting table rows

Postby amy.zhao » Wed Sep 19, 2012 1:29 am

Dear Peter,

You are welcome. :lol:
If you have any problems, please feel free to contact us.
Have a nice day!

Best regards,
Amy
e-iceblue support
User avatar
amy.zhao
 
Posts: 2277
Joined: Wed Jun 27, 2012 8:50 am


Return to Spire.Doc

Who is online

Users browsing this forum: No registered users and 2 guests