Table Column Width

Technical support for Spire.Doc

Moderator: iceblue support

Table Column Width

Postby ahamed » Mon Nov 14, 2011 5:26 pm

Hi,

I am have created a table in the document through following code :

foreach (object T in arr10)
{
Partbuilder Q = (Partbuilder)T;

foreach (object S in arr2)
{
Partbuilder B = (Partbuilder)S;

Table table = new Table(nav.Document);
nav.InsertTable(table);

//Table contents goes here
//Section section = document.AddSection();
String[] Footer = { "","","" };
string price = Db.Checkfordecimal(B.ListPrice);

string leftcolumn = "Supply " + B.Quantity + " X " + B.ProductDescription + "" + B.ProductCode + "";

String[][] data ={
new String []{""+leftcolumn +"","","£" + price + ""}
};

table.ResetCells(data.Length + 1, Footer.Length);

for (int r = 0; r < data.Length; r++)
{
TableRow datarow = table.Rows[r + 1];
datarow.Height = 10;
datarow.RowFormat.BackColor = Color.Empty;





for (int c = 0; c < data[r].Length; c++)
{
datarow.Cells[c].CellFormat.VerticalAlignment = VerticalAlignment.Middle;
ITextRange Text2 = datarow.Cells[c].AddParagraph().AppendText("" + data[r][c] + "");
Text2.CharacterFormat.FontName = "verdana";
Text2.CharacterFormat.FontSize = 10;
Text2.CharacterFormat.Italic = true;
Text2.CharacterFormat.Bold = false;
}

}

}

Problem that currntly having:
1. How can I specify table column width?
2.its generats empty row for each row above, how to remove those empty rows.
3.Is there any way that I can align right text in a column.

Please advise by code as soon as possible.
Thank you very much for your time.
ahamed
 
Posts: 15
Joined: Mon Aug 15, 2011 1:09 pm

Re: Table Column Width

Postby Tina.Lin » Tue Nov 15, 2011 3:08 am

Hello ahamed,

Thank you for you inquiry.

We have made a demo which achieved your first and second requirements. Spire.Doc just now can't support align right text in a column.

Sorry for the inconvenience caused by us.

Have a nice day.
You do not have the required permissions to view the files attached to this post.
Tina
Technical Support/Developer,
e-iceblue Support Team
User avatar
Tina.Lin
 
Posts: 152
Joined: Tue Sep 13, 2011 5:37 am


Return to Spire.Doc

Who is online

Users browsing this forum: No registered users and 1 guest