I am generating a docx document with Open XML and I have a problem. Although I has been able to apply styles to the headers, I want to apply the margins of the headers to the following paragrpahs, in the same way that word does. For example, if you add a Title with Header 2 the following paragraph has the same left margin that the header 2 style.
I am adding the data of the paragraph in the following code:
DocumentFormat.OpenXml.Wordprocessing.Paragraph pDesc = body.AppendChild(newDocumentFormat.OpenXml.Wordprocessing.Paragraph());DocumentFormat.OpenXml.Wordprocessing.Run rDesc = pDesc.AppendChild(newDocumentFormat.OpenXml.Wordprocessing.Run());DocumentFormat.OpenXml.Wordprocessing.Text tDesc = rDesc.AppendChild(newDocumentFormat.OpenXml.Wordprocessing.Text(mainNode.Description));
pDesc.ParagraphProperties=newDocumentFormat.OpenXml.Wordprocessing.ParagraphProperties();
I suppose that the solution is the paragraph properties but I don't know if I have to create a style for each kind of paragraph after each kind o header (header1, header2, header3...) or there is a way of saying the paragraph applys part of the style of the header.
Thanks a lot in advance.