Hi,
2 quick questions concerning creating word documents using infragistics in c#. I have tried online to find solutions but unfortunately can't find anything
I was looking to insert a horizontal line on my word document i have created across the page. I am sure this is easy but can't find an example of it.
Another issue i am having is the width of the table i have created. When i create a table it seems to set the width automatically. I have played around with the other attributes but can't seem to find the correct one. The code is below
Any help would be appreciated.
Thanks
TableBorderProperties
borderProps = docWriter.CreateTableBorderProperties();
borderProps.Color =
Color.Blue;
borderProps.Style =
TableBorderStyle.Single;
// Create table properties
tableProps.Alignment =
ParagraphAlignment.Center;
tableProps.BorderProperties.Color = borderProps.Color;
tableProps.BorderProperties.Style = borderProps.Style;
// Create table row properties
//Make the row a Header
rowProps.IsHeaderRow =
false;
// Create table cell properties
cellProps.VerticalAlignment =
TableCellVerticalAlignment.Center;
docWriter.StartTable(2, tableProps);
// Begin a Row and apply table row properties
cellProps.Reset();
// DATA ROW
docWriter.StartTableRow();
font.Reset();
font.Name =
"Verdana";
font.ForeColor =
Color.Black;
font.Size = .14f;
// Cell Value for 2nd row 1st column
docWriter.StartTableCell(cellProps);
docWriter.StartParagraph();
// Create an Anchored Image
docWriter.AddAnchoredPicture(anchPic);
docWriter.EndParagraph();
docWriter.EndTableCell();
// Cell Value for 2nd row 2nd column
docWriter.AddTextRun(
"Some text in here.", font);
docWriter.AddNewLine();
"More text in here", font);
"and some more text", font);
docWriter.EndTableRow();
docWriter.EndTable();
Hello Brid,
Could you please review the sample attached to this post and see if it meets your requirements. The height is based on the content in the cells.
Please feel free to let me know if I misunderstood you or if you have any other questions.
Hi Brian
I am also designing word docs using infragistics word library. Can you give me an example of using the
TableProperties.PreferredWidth and also how do you set the height of a table.
Thanks and Regards.
Brid
Excellent Brian. Cheers for the reply.
cromster said:I was looking to insert a horizontal line on my word document i have created across the page.
1. Use WordDocumentWriter.CreateAnchored/CreateVmlShape to create a line2. Use WordDocumentWriter.AddAnchoredShape/AddInlineShape to add it to the current paragraph
cromster said:Another issue i am having is the width of the table i have created. When i create a table it seems to set the width automatically.
Use the TableProperties.PreferredWidth property.
anyone got any ideas please