How can the parts of the document be discovered and the fontsize changed?
Here is a sample table used,
<w:sdt docpart="2CFD5BC34C8546929C222BE9FE7FE85A" id="-566108754" sdttag="content control 1" showingplchdr="t" title="content control 1">Main Title here.</w:sdt> <w:sdt docpart="B3E0DD81C49046B5BB844C80F7E0D939" id="1165130247">Date of Report</w:sdt> |
Salesman name: <w:sdt docpart="B3E0DD81C49046B5BB844C80F7E0D939" id="193582825" showingplchdr="t">John Smith</w:sdt> Another textbox: <w:sdt docpart="B3E0DD81C49046B5BB844C80F7E0D939" id="-1475904701" showingplchdr="t">Jane Smith.</w:sdt> |
RunProperties runprop = new RunProperties(); Run run = new Run(); Run run2 = new Run(); FontSize fonz = new FontSize(); RunProperties runprop2 = new RunProperties(); RunFonts runf = new RunFonts(); foreach (DocumentFormat.OpenXml.Wordprocessing.TableRow tableRow in table.Descendants<DocumentFormat.OpenXml.Wordprocessing.TableRow>()) { i++; foreach (DocumentFormat.OpenXml.Wordprocessing.TableCell tableCell in tableRow.Descendants<DocumentFormat.OpenXml.Wordprocessing.TableCell>()) { j++; DocumentFormat.OpenXml.Wordprocessing.Paragraph para = tableCell.GetFirstChild<DocumentFormat.OpenXml.Wordprocessing.Paragraph>(); run = para.GetFirstChild<Run>(); if (run != null) {
// run or para, both have the same result fonz = run.Descendants<DocumentFormat.OpenXml.Wordprocessing.FontSize>().FirstOrDefault(); fonz.Val = "6"; } } }
Here if this code runs, the text outside of the content controls is changed to '6' fontsize. but the top part is only content control and the bottom is label + content control. The label here is "Salesman name:" and "Another textbox"
Using the above reference the fontsize of this can be changed, but the text inside the sdt's is not touched
How are these parts 'addressed' to be able to change the properties?