Aspose.Words - how to access certain docx content

I have a docx file (like the attached smallest.docx) containing an email saved from Outlook.

If I open the docx file in the Open Document Format viewer in Visual Studio, and go to the /word/document.xml node, I can see that the horizontal lines that separate successive emails are represented by the <w:divId> tag. If I open the /word/webSettings.xml node, I can see a list of all available div ids. The snippet below shows that the <w:divId> tag is a child of the <w:pPr> paragraph Properties tag:

<w:p w:rsidR="00134C43" w:rsidRDefault="0088250C" w:rsidP="0088250C">
		<w:pStyle w:val="Normal0"/>
		<w:outlineLvl w:val="0"/>
		<w:divId w:val="1893810567"/>
			<w:color w:val="1F497D"/>
			<w:rFonts w:ascii="Tahoma" w:hAnsi="Tahoma" w:cs="Tahoma"/>
			<w:sz w:val="20"/>
			<w:szCs w:val="20"/>
			<w:lang w:val="en-US"/>

. . .

When I open the same docx file as an Aspose.Words.Document .NET object, although in the VS debugger I can see the Style and Outline level members of the ParagraphSettings object for this Paragraph, I can’t see how to access or manipulate the divId.

Is it possible? How do I do it?

Hi Brian,

Thanks for your inquiry. w:divId is associated HTML div ID.

Please note that Aspose.Words mimics the same behavior as MS Word does. Please open your input document in MS Word and share which Paragraph formatting you want to get using Aspose.Words. We will then provide you more information about your query.

Thanks for the reply Tahir. I’d like to be able to programmatically change the appearance of the w:divId items inserted by Outlook when it creates doc files with email content. In the sample document I attached earlier, the w:divId is the pale blue horizontal line between the Evaluation and From: lines.

My question is - if I open Smallest.docx as an aspose.words.document, how would I programmatically change the colour and style of the w:divId line? Say change it into a thick red line?

I can edit the appearance of Smallest.docx having opened it in Word:

  1. Place the cursor on the From: line,
  2. Open the Borders and Shading dialog (in Word 2013 do this from the bottom of the Borders drop-down in the Paragraph toolbar)
  3. The dialog displays with the Borders tab visible. The ‘Custom’ Setting is already selected (because the border setting applies to only the topmost edge rather than all edges).
  4. Select new Style, Color and Width values then click on the topmost border in the Preview pane to apply the new settings.
  5. Dismiss the Borders and Shading dialog with [OK] and the appearance of the div line changes.

If I make these changes it changes the style of that one instance of the w:divId - it doesn’t globally change all the w:divId instances in the document. Secondary question - how would I programmatically change the global settings for all w:divId items rather than changing one instance?


Hi Brian,

Thanks for sharing the detail. Unfortunately, Aspose.Words does not support the requested feature at the moment. However, we have logged this feature request as WORDSNET-12654 in our issue tracking system. You will be notified via this forum thread once this feature is available.

We apologize for your inconvenience.