Is there any way to create the Paragraph, run it and apply multiple properties in a single statemement instead of creating 'RunProperties' and append the the styles on by one. In the example I am trying to add a second style - Font size like that but it doesn't work.
TableCell tc1_1 = new TableCell();
tc1_1.Append(new TableCellProperties(new TableCellWidth() { Type = TableWidthUnitValues.Dxa, Width = "5500" }));
tc1_1.Append(new Paragraph(new Run(
new Text("Test Company Name 123123123 123123"),
new FontSize() { Val = "8" }
)));
The issue is that you are creating invalid Open XML markup. For example, if you want to specify the font size for a specific run, this needs to be done by adding the FontSize
instance to a RunProperties
instance (ie, w:rPr
element).
My general recommendation is to look at Open XML markup created by Microsoft Word for what you want to have in your document, eg, a table cell with some paragraphs and runs formatted in a certain way. You can then mimic in your code what Word has created.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.