Issue Loading ListParagraph when using Document template

Open
#471 1 comment 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Assessment

Difficulty
4/5
Estimated time
3-5 days
Newbie friendliness
28/100
Issue type
Bug
Clarity
Needs clarification
Activity status
Stale
Tech stack
csharp
Domain
backend

Research direction

Start in Container.cs at the reported this.Xml.Add(newXElement) call and reproduce the failure with a loaded template containing a ListParagraph. Compare the generated XML with the supplied example and verify that the resulting document retains its paragraphs and opens correctly when the list is present.

Written by the indexing model from the issue text.

Description

We have a solution where users can generate DocX documents from scratch or they can load a template (with headers footers etc ).
When we are genrating the document from scratch all works fine
The problem is that if user selects a template and also we have bulleted list in a paragraph it throw error.
When user load a template but there is no lists all works fine.
The XML generate when it braks looks like this:

<w:body xmlns:w="http://schemas.openxmlformats.org/wordprocessingml/2006/main">
<w:p w14:paraId="161B2D7A" w14:textId="77777777" w:rsidR="00896AA2" w:rsidRDefault="00896AA2" xmlns:w14="http://schemas.microsoft.com/office/word/2010/wordml" />
<w:p w14:paraId="13050EA5" w14:textId="180BC5E7" w:rsidR="002B4DCE" w:rsidRDefault="002B4DCE" xmlns:w14="http://schemas.microsoft.com/office/word/2010/wordml">
<w:pPr>
<w:rPr>
<w:b />
<w:bCs />
<w:sz w:val="28" />
<w:szCs w:val="28" />
</w:rPr>
</w:pPr>
<w:r w:rsidRPr="00B6023F">
<w:rPr>
<w:b />
<w:bCs />
<w:sz w:val="28" />
<w:szCs w:val="28" />
</w:rPr>
<w:t>NAME</w:t>
</w:r>
</w:p>
<w:p w14:paraId="2A7052DE" w14:textId="77777777" w:rsidR="00A60E3B" w:rsidRPr="00B6023F" w:rsidRDefault="00A60E3B" xmlns:w14="http://schemas.microsoft.com/office/word/2010/wordml">
<w:pPr>
<w:rPr>
<w:b />
<w:bCs />
<w:sz w:val="28" />
<w:szCs w:val="28" />
</w:rPr>
</w:pPr>
</w:p>
<w:p w14:paraId="55C27F45" w14:textId="11E76331" w:rsidR="00B6023F" w:rsidRDefault="00B6023F" xmlns:w14="http://schemas.microsoft.com/office/word/2010/wordml">
<w:r>
<w:t>DATE:</w:t>
</w:r>
</w:p>
<w:p w14:paraId="0E432B64" w14:textId="29C1FBD8" w:rsidR="002B4DCE" w:rsidRDefault="00B6023F" xmlns:w14="http://schemas.microsoft.com/office/word/2010/wordml">
<w:r>
<w:t>IDENTIFIER</w:t>
</w:r>
<w:r w:rsidR="002B4DCE">
<w:t xml:space="preserve">: </w:t>
</w:r>
</w:p>
<w:p w14:paraId="299A3CEB" w14:textId="29AB26A1" w:rsidR="00B6023F" w:rsidRDefault="00B6023F" xmlns:w14="http://schemas.microsoft.com/office/word/2010/wordml">
<w:r>
<w:t xml:space="preserve">phone: e-mail: </w:t>
</w:r>
</w:p>
<w:p w14:paraId="194E0147" w14:textId="33640C07" w:rsidR="00A60E3B" w:rsidRDefault="00A60E3B" xmlns:w14="http://schemas.microsoft.com/office/word/2010/wordml">
<w:r>
<w:t>Address:</w:t>
</w:r>
</w:p>
<w:sectPr w:rsidR="00A60E3B" w:rsidSect="002B4DCE">
<w:headerReference w:type="default" r:id="rId6" xmlns:r="http://schemas.openxmlformats.org/officeDocument/2006/relationships" />
<w:footerReference w:type="even" r:id="rId7" xmlns:r="http://schemas.openxmlformats.org/officeDocument/2006/relationships" />
<w:footerReference w:type="default" r:id="rId8" xmlns:r="http://schemas.openxmlformats.org/officeDocument/2006/relationships" />
<w:pgSz w:w="11906" w:h="16838" />
<w:pgMar w:top="1134" w:right="851" w:bottom="851" w:left="851" w:header="567" w:footer="709" w:gutter="0" />
<w:cols w:space="708" />
<w:docGrid w:linePitch="360" />
</w:sectPr>
<w:p>
<w:pPr>
<w:pStyle w:val="Ttulo1" />
</w:pPr>
<w:r>
<w:rPr>
<w:lang w:val="es-ES" />
</w:rPr>
<w:t>Información clínica</w:t>
</w:r>
</w:p>
<w:p>
<w:pPr />
<w:r>
<w:rPr>
<w:i></w:i>
<w:lang w:val="es-ES"></w:lang>
<w:u w:val=""></w:u>
</w:rPr>
<w:t>Last revision</w:t>
</w:r>
</w:p>
<w:tbl>
<w:tblPr>
<w:tblStyle w:val="TableGrid" />
<w:tblW w:w="5000" w:type="pct" />
<w:tblLook w:val="04A0" />
<w:jc w:val="left" />
<w:tblBorders>
<w:top w:val="none" w:sz="2" w:space="0" w:color="FFFFFF"></w:top>
<w:bottom w:val="none" w:sz="2" w:space="0" w:color="FFFFFF"></w:bottom>
<w:left w:val="none" w:sz="2" w:space="0" w:color="FFFFFF"></w:left>
<w:right w:val="none" w:sz="2" w:space="0" w:color="FFFFFF"></w:right>
<w:insideH w:val="none" w:sz="2" w:space="0" w:color="FFFFFF"></w:insideH>
<w:insideV w:val="none" w:sz="2" w:space="0" w:color="FFFFFF"></w:insideV>
</w:tblBorders>
</w:tblPr>
<w:tr>
<w:tc>
<w:tcPr>
<w:tcW w:w="2310" w:type="pct" />
<w:shd w:val="clear" w:color="auto" w:fill="FFFFFF"></w:shd>
</w:tcPr>
<w:p>
<w:pPr />
</w:p>
</w:tc>
</w:tr>
<w:tr>
<w:tc>
<w:tcPr>
<w:tcW w:w="2310" w:type="dxa" />
<w:tcMar>
<w:left w:type="dxa" w:w="0"></w:left>
</w:tcMar>
</w:tcPr>
<w:p>
<w:pPr />
</w:p>
<w:tbl>
<w:tblPr>
<w:tblStyle w:val="TableGrid" />
<w:tblW w:w="5000" w:type="pct" />
<w:tblLook w:val="04A0" />
<w:jc w:val="left" />
<w:tblBorders>
<w:top w:val="single" w:sz="2" w:space="0" w:color="C5C5C5"></w:top>
<w:bottom w:val="single" w:sz="2" w:space="0" w:color="C5C5C5"></w:bottom>
<w:left w:val="single" w:sz="2" w:space="0" w:color="C5C5C5"></w:left>
<w:right w:val="single" w:sz="2" w:space="0" w:color="C5C5C5"></w:right>
<w:insideH w:val="single" w:sz="2" w:space="0" w:color="C5C5C5"></w:insideH>
<w:insideV w:val="single" w:sz="2" w:space="0" w:color="C5C5C5"></w:insideV>
</w:tblBorders>
</w:tblPr>
<w:tr>
<w:tc>
<w:tcPr>
<w:tcW w:w="2310" w:type="pct" />
<w:shd w:val="clear" w:color="auto" w:fill="237BAA"></w:shd>
<w:tcMar>
<w:left w:type="dxa" w:w="100"></w:left>
</w:tcMar>
</w:tcPr>
<w:p>
<w:pPr>
<w:spacing w:before="20" w:after="20" />
</w:pPr>
<w:r>
<w:rPr>
<w:lang w:val="es-ES" />
<w:b />
<w:color w:val="FFFFFF" />
</w:rPr>
<w:t>Datos demográficos</w:t>
</w:r>
</w:p>
</w:tc>
</w:tr>
<w:tr>
<w:tc>
<w:tcPr>
<w:tcW w:w="2310" w:type="dxa" />
<w:shd w:val="clear" w:color="auto" w:fill="F2F2F2"></w:shd>
</w:tcPr>
<w:p>
<w:pPr />
</w:p>
<w:p>
<w:pPr>
<w:pStyle w:val="ListParagraph" />
<w:numPr>
<w:ilvl w:val="0" />
<w:numId w:val="2" />
</w:numPr>
<w:spacing w:after="20" w:before="20" />
<w:ind w:left="357" w:hanging="357" />
</w:pPr>
<w:r>
<w:t xml:space="preserve">fsdfdsfds</w:t>
</w:r>
</w:p>
</w:tc>
</w:tr>
</w:tbl>
<w:p>
<w:pPr />
</w:p>
</w:tc>
</w:tr>
</w:tbl>
</w:body>

After adding the list paragraph if we inspect the document it looks like this:
image

After this.Xml.Add( newXElement ); in COntainer.cs, Document is broken (no paragraphs etc).

Any idea why we are having this issue?

Thanks in advance for your response

Dominant language
C#
Stars
1.9k
Forks
483
PR merge metrics
No merged PRs in 30d

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from xceedsoftware/DocX

All issues in xceedsoftware/DocX

Similar issues

More C# issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.