Hi,
We need to retain the Bold Formatting from the Style Definition and insert the new formatting elements to retain the bold for the paragraph/text.
Step 1: Search for the style definition which has "<w:b/>" for example in <w:style w:type="paragraph" w:styleId="Heading1"> in "w:styles" group definition.
Step 2: Match the element like "<w:pStyle w:val="Heading1"/>" in "<w:p>" and then insert new element "<w:rPr><w:b w:val="on"/></w:rPr>" to retain the bold property in the current paragraph.
Input Word ML
Code:
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<?mso-application progid="Word.Document"?>
<w:wordDocument xmlns:aml="http://schemas.microsoft.com/aml/2001/core" xmlns:wpc="http://schemas.microsoft.com/office/word/2010/wordprocessingCanvas" xmlns:dt="uuid:C2F41010-65B3-11d1-A29F-00AA00C14882" xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" xmlns:o="urn:schemas-microsoft-com:office:office" xmlns:v="urn:schemas-microsoft-com:vml" xmlns:w10="urn:schemas-microsoft-com:office:word" xmlns:w="http://schemas.microsoft.com/office/word/2003/wordml" xmlns:wx="http://schemas.microsoft.com/office/word/2003/auxHint" xmlns:wne="http://schemas.microsoft.com/office/word/2006/wordml" xmlns:wsp="http://schemas.microsoft.com/office/word/2003/wordml/sp2" xmlns:sl="http://schemas.microsoft.com/schemaLibrary/2003/core" w:macrosPresent="no" w:embeddedObjPresent="no" w:ocxPresent="no" xml:space="preserve"><w:ignoreSubtree w:val="http://schemas.microsoft.com/office/word/2003/wordml/sp2"/>
<w:styles>
<w:style w:type="paragraph" w:default="on" w:styleId="Normal"><w:name w:val="Normal"/><w:rsid w:val="00DC2CAF"/><w:pPr><w:spacing w:after="200" w:line="276" w:line-rule="auto"/></w:pPr><w:rPr><wx:font wx:val="Times New Roman"/><w:sz w:val="22"/><w:sz-cs w:val="22"/><w:lang w:val="EN-US" w:fareast="EN-US" w:bidi="AR-SA"/></w:rPr></w:style>
<w:style w:type="paragraph" w:styleId="Heading1"><w:name w:val="heading 1"/><wx:uiName wx:val="Heading 1"/><w:basedOn w:val="Normal"/><w:next w:val="Normal"/><w:link w:val="Heading1Char"/><w:rsid w:val="00E67B1F"/><w:pPr><w:keepNext/><w:keepLines/><w:spacing w:before="480" w:after="0"/><w:outlineLvl w:val="0"/></w:pPr><w:rPr><w:rFonts w:ascii="Cambria" w:h-ansi="Cambria"/><wx:font wx:val="Cambria"/><w:b/><w:b-cs/><w:color w:val="365F91"/><w:sz w:val="28"/><w:sz-cs w:val="28"/></w:rPr></w:style>
<w:style w:type="character" w:default="on" w:styleId="DefaultParagraphFont"><w:name w:val="Default Paragraph Font"/></w:style>
<w:style w:type="table" w:default="on" w:styleId="TableNormal"><w:name w:val="Normal Table"/><wx:uiName wx:val="Table Normal"/><w:rPr><wx:font wx:val="Times New Roman"/><w:lang w:val="EN-US" w:fareast="EN-US" w:bidi="AR-SA"/></w:rPr><w:tblPr><w:tblInd w:w="0" w:type="dxa"/><w:tblCellMar><w:top w:w="0" w:type="dxa"/><w:left w:w="108" w:type="dxa"/><w:bottom w:w="0" w:type="dxa"/><w:right w:w="108" w:type="dxa"/></w:tblCellMar></w:tblPr></w:style>
<w:style w:type="list" w:default="on" w:styleId="NoList"><w:name w:val="No List"/></w:style>
<w:style w:type="character" w:styleId="Heading1Char"><w:name w:val="Heading 1 Char"/><w:link w:val="Heading1"/><w:rsid w:val="00E67B1F"/><w:rPr><w:rFonts w:ascii="Cambria" w:fareast="Times New Roman" w:h-ansi="Cambria" w:cs="Times New Roman"/><w:b/><w:b-cs/><w:color w:val="365F91"/><w:sz w:val="28"/><w:sz-cs w:val="28"/></w:rPr></w:style></w:styles><w:body><wx:sect>
<w:p wsp:rsidR="00E67B1F" wsp:rsidRDefault="00EB3BDD"><w:r><w:t>On the Insert tab, the galleries include items that are designed to coordinate with the overall look of your document. You can use these galleries to insert tables, headers, footers, lists, cover pages, and other document building blocks. When you create p</w:t></w:r><w:r><w:t>ictures, charts, or diagrams, they also coordinate with your current document look. You can easily change the formatting of selected text in the document text by choosing a look for the selected text from the Quick Styles gallery on the Home tab. You can a</w:t></w:r><w:r><w:t>lso format text directly by using the other controls on the Home tab.</w:t></w:r></w:p><wx:sub-section>
<w:p wsp:rsidR="00E67B1F" wsp:rsidRDefault="00EB3BDD" wsp:rsidP="00E67B1F">
<w:pPr>
<w:pStyle w:val="Heading1"/></w:pPr><w:r><w:t>Chapter One With Bold</w:t></w:r></w:p>
<w:p wsp:rsidR="00E67B1F" wsp:rsidRDefault="00EB3BDD"><w:r><w:t>Most controls offer a choice of using the look from the current theme or using a format that you specify directly. To change the overall look of your document, choo</w:t></w:r><w:r><w:t>se new Theme elements on the Page Layout tab. To change the looks available in the Quick Style gallery, use the Change Current Quick Style Set command. Both the Themes gallery and the Quick Styles gallery provide reset commands so that you can always resto</w:t></w:r><w:r><w:t>re the look of your document to the original contained in your current template. On the Insert tab, the galleries include items that are designed to coordinate with the overall look of your document.</w:t></w:r></w:p></wx:sub-section><wx:sub-section>
<w:p wsp:rsidR="00E67B1F" wsp:rsidRDefault="00EB3BDD" wsp:rsidP="00E67B1F">
<w:pPr>
<w:pStyle w:val="Heading1"/></w:pPr><w:r><w:t>Chapter Two </w:t></w:r><w:r wsp:rsidRPr="00E67B1F"><w:rPr><w:b w:val="off"/></w:rPr><w:t>Without Bold</w:t></w:r></w:p>
<w:p wsp:rsidR="00E67B1F" wsp:rsidRDefault="00EB3BDD"><w:r><w:t>To change the overall look of your document, choose new Theme elements on the Page Layout tab. To change the looks available in the Quick Style gallery, use the Change Current Quick Style Set command. Both the Themes gallery and the Quick Styles gallery pr</w:t></w:r><w:r><w:t>ovide reset commands so that you can always restore the look of your document to the original contained in your current template. On the Insert tab, the galleries include items that are designed to coordinate with the overall look of your document. You can</w:t></w:r><w:r><w:t> use these galleries to insert tables, headers, footers, lists, cover pages, and other document building blocks.</w:t></w:r></w:p></wx:sub-section><w:sectPr wsp:rsidR="00E67B1F" wsp:rsidSect="00DC2CAF">
<w:pgSz w:w="12240" w:h="15840"/>
<w:pgMar w:top="1440" w:right="1440" w:bottom="1440" w:left="1440" w:header="720" w:footer="720" w:gutter="0"/><w:cols w:space="720"/><w:docGrid w:line-pitch="360"/></w:sectPr></wx:sect></w:body></w:wordDocument>
Output Formatted XML
Code:
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<?mso-application progid="Word.Document"?>
<w:wordDocument xmlns:aml="http://schemas.microsoft.com/aml/2001/core" xmlns:wpc="http://schemas.microsoft.com/office/word/2010/wordprocessingCanvas" xmlns:dt="uuid:C2F41010-65B3-11d1-A29F-00AA00C14882" xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" xmlns:o="urn:schemas-microsoft-com:office:office" xmlns:v="urn:schemas-microsoft-com:vml" xmlns:w10="urn:schemas-microsoft-com:office:word" xmlns:w="http://schemas.microsoft.com/office/word/2003/wordml" xmlns:wx="http://schemas.microsoft.com/office/word/2003/auxHint" xmlns:wne="http://schemas.microsoft.com/office/word/2006/wordml" xmlns:wsp="http://schemas.microsoft.com/office/word/2003/wordml/sp2" xmlns:sl="http://schemas.microsoft.com/schemaLibrary/2003/core" w:macrosPresent="no" w:embeddedObjPresent="no" w:ocxPresent="no" xml:space="preserve"><w:ignoreSubtree w:val="http://schemas.microsoft.com/office/word/2003/wordml/sp2"/>
<w:styles>
<w:style w:type="paragraph" w:default="on" w:styleId="Normal"><w:name w:val="Normal"/><w:rsid w:val="00DC2CAF"/><w:pPr><w:spacing w:after="200" w:line="276" w:line-rule="auto"/></w:pPr><w:rPr><wx:font wx:val="Times New Roman"/><w:sz w:val="22"/><w:sz-cs w:val="22"/><w:lang w:val="EN-US" w:fareast="EN-US" w:bidi="AR-SA"/></w:rPr></w:style>
<w:style w:type="paragraph" w:styleId="Heading1"><w:name w:val="heading 1"/><wx:uiName wx:val="Heading 1"/><w:basedOn w:val="Normal"/><w:next w:val="Normal"/><w:link w:val="Heading1Char"/><w:rsid w:val="00E67B1F"/><w:pPr><w:keepNext/><w:keepLines/><w:spacing w:before="480" w:after="0"/><w:outlineLvl w:val="0"/></w:pPr><w:rPr><w:rFonts w:ascii="Cambria" w:h-ansi="Cambria"/><wx:font wx:val="Cambria"/><w:b/><w:b-cs/><w:color w:val="365F91"/><w:sz w:val="28"/><w:sz-cs w:val="28"/></w:rPr></w:style>
<w:style w:type="character" w:default="on" w:styleId="DefaultParagraphFont"><w:name w:val="Default Paragraph Font"/></w:style>
<w:style w:type="table" w:default="on" w:styleId="TableNormal"><w:name w:val="Normal Table"/><wx:uiName wx:val="Table Normal"/><w:rPr><wx:font wx:val="Times New Roman"/><w:lang w:val="EN-US" w:fareast="EN-US" w:bidi="AR-SA"/></w:rPr><w:tblPr><w:tblInd w:w="0" w:type="dxa"/><w:tblCellMar><w:top w:w="0" w:type="dxa"/><w:left w:w="108" w:type="dxa"/><w:bottom w:w="0" w:type="dxa"/><w:right w:w="108" w:type="dxa"/></w:tblCellMar></w:tblPr></w:style>
<w:style w:type="list" w:default="on" w:styleId="NoList"><w:name w:val="No List"/></w:style>
<w:style w:type="character" w:styleId="Heading1Char"><w:name w:val="Heading 1 Char"/><w:link w:val="Heading1"/><w:rsid w:val="00E67B1F"/><w:rPr><w:rFonts w:ascii="Cambria" w:fareast="Times New Roman" w:h-ansi="Cambria" w:cs="Times New Roman"/><w:b/><w:b-cs/><w:color w:val="365F91"/><w:sz w:val="28"/><w:sz-cs w:val="28"/></w:rPr></w:style></w:styles><w:body><wx:sect>
<w:p wsp:rsidR="00E67B1F" wsp:rsidRDefault="00EB3BDD"><w:r><w:t>On the Insert tab, the galleries include items that are designed to coordinate with the overall look of your document. You can use these galleries to insert tables, headers, footers, lists, cover pages, and other document building blocks. When you create p</w:t></w:r><w:r><w:t>ictures, charts, or diagrams, they also coordinate with your current document look. You can easily change the formatting of selected text in the document text by choosing a look for the selected text from the Quick Styles gallery on the Home tab. You can a</w:t></w:r><w:r><w:t>lso format text directly by using the other controls on the Home tab.</w:t></w:r></w:p><wx:sub-section>
<w:p wsp:rsidR="00E67B1F" wsp:rsidRDefault="00EB3BDD" wsp:rsidP="00E67B1F">
<w:pPr>
<w:pStyle w:val="Heading1"/></w:pPr><w:r><w:rPr><w:b w:val="on"/></w:rPr><w:t>Chapter One With Bold</w:t></w:r></w:p>
<w:p wsp:rsidR="00E67B1F" wsp:rsidRDefault="00EB3BDD"><w:r><w:t>Most controls offer a choice of using the look from the current theme or using a format that you specify directly. To change the overall look of your document, choo</w:t></w:r><w:r><w:t>se new Theme elements on the Page Layout tab. To change the looks available in the Quick Style gallery, use the Change Current Quick Style Set command. Both the Themes gallery and the Quick Styles gallery provide reset commands so that you can always resto</w:t></w:r><w:r><w:t>re the look of your document to the original contained in your current template. On the Insert tab, the galleries include items that are designed to coordinate with the overall look of your document.</w:t></w:r></w:p></wx:sub-section><wx:sub-section>
<w:p wsp:rsidR="00E67B1F" wsp:rsidRDefault="00EB3BDD" wsp:rsidP="00E67B1F">
<w:pPr>
<w:pStyle w:val="Heading1"/></w:pPr><w:r><w:rPr><w:b w:val="on"/></w:rPr><w:t>Chapter Two </w:t></w:r><w:r wsp:rsidRPr="00E67B1F"><w:rPr><w:b w:val="off"/></w:rPr><w:t>Without Bold</w:t></w:r></w:p>
<w:p wsp:rsidR="00E67B1F" wsp:rsidRDefault="00EB3BDD"><w:r><w:t>To change the overall look of your document, choose new Theme elements on the Page Layout tab. To change the looks available in the Quick Style gallery, use the Change Current Quick Style Set command. Both the Themes gallery and the Quick Styles gallery pr</w:t></w:r><w:r><w:t>ovide reset commands so that you can always restore the look of your document to the original contained in your current template. On the Insert tab, the galleries include items that are designed to coordinate with the overall look of your document. You can</w:t></w:r><w:r><w:t> use these galleries to insert tables, headers, footers, lists, cover pages, and other document building blocks.</w:t></w:r></w:p></wx:sub-section><w:sectPr wsp:rsidR="00E67B1F" wsp:rsidSect="00DC2CAF">
<w:pgSz w:w="12240" w:h="15840"/>
<w:pgMar w:top="1440" w:right="1440" w:bottom="1440" w:left="1440" w:header="720" w:footer="720" w:gutter="0"/><w:cols w:space="720"/><w:docGrid w:line-pitch="360"/></w:sectPr></wx:sect></w:body></w:wordDocument>
The Changes required in the Output Formatted XML is mentioned below:
Code:
<w:pStyle w:val="Heading1"/></w:pPr><w:r><w:rPr><w:b w:val="on"/></w:rPr><w:t>Chapter One With Bold</w:t></w:r></w:p>
It would be great help for us if someone give any suggestion/solution to solve it.
Note: This xml is WordML so that input/output file has more elements. If you need more explanation then let us know.
Thanks,
Ram