vb.net - text center justified in openxml Word document -
i trying apply formatting text using open xml. add bold, 18 pt font , have centered.
the bold , font size formatting applies correctly cannot center justification work. first use of open xml, appreciated.
dim mainpart maindocumentpart = mydoc.addmaindocumentpart() mainpart.document = new document() dim body new body() dim paragraph new paragraph() dim run_paragraph new run() 'we want put text output document dim text_paragraph new text("executive summary - " + name) 'append elements appropriately. 'bold dim runproperties runproperties = run_paragraph.appendchild(new runproperties()) dim bold new bold bold.val = onoffvalue.fromboolean(true) dim fontsize new fontsize fontsize.val = "22" runproperties.appendchild(fontsize) runproperties.appendchild(bold) 'center dim paragraphproperties paragraphproperties = run_paragraph.appendchild(new paragraphproperties()) dim justification new justification justification.val = justificationvalues.center paragraphproperties.appendchild(justification) run_paragraph.appendchild(text_paragraph) paragraph.append(run_paragraph) body.append(paragraph) mainpart.document.append(body) mainpart.document.save() response.redirect("~/summaries/" + documentfilename)
try add paragraphproperties
paragraph
object (instead of run_paragraph
)
replace:
dim paragraphproperties paragraphproperties = run_paragraph.appendchild(new paragraphproperties())
with:
dim paragraphproperties paragraphproperties = paragraph.appendchild(new paragraphproperties())
Comments
Post a Comment