Comments (4)
Yup, I'll add it. I think the second part (NumId) is incorrect in your example though, it's a reference to a numbering definition defined in numbering.xml
from unioffice.
A reference to number.xml
seems a little more legit than choosing a random int :).
Thanks, yet again.
from unioffice.
@freb Done, check out _examples/document/simple for example usage.
To mimic what you were doing, you can do this instead:
para.SetNumberingLevel(level)
para.SetNumberingDefinitionByID(defnID)
from unioffice.
I think there might be an error in the implementation. I also might be wrong.
In document.xml
, paragraphs look like look like this (second indented item):
<w:p w14:paraId="1D8F95A7" w14:textId="294F4857" w:rsidP="00BD6BD9" w:rsidR="00BD6BD9" w:rsidRDefault="00BD6BD9">
<w:pPr>
<w:pStyle w:val="ListOrdered"/>
<w:numPr>
<w:ilvl w:val="1"/>
<w:numId w:val="2"/>
</w:numPr>
</w:pPr>
<w:r>
<w:t>List Item Text Here</w:t>
</w:r>
</w:p>
In numbering.xml
, there are num
's and abstractNum
's. Mine looks like this:
<w:abstractNum w15:restartNumberingAfterBreak="0" w:abstractNumId="0">
...
</w:abstractNum>
<w:abstractNum w15:restartNumberingAfterBreak="0" w:abstractNumId="1">
...
</w:abstractNum>
<w:num w:numId="1">
<w:abstractNumId w:val="0"/>
</w:num>
<w:num w:numId="2">
<w:abstractNumId w:val="1"/>
</w:num>
The numId
value in the paragraph looks like it points to a <w:num>
, not an abstractNum
.
The helper methods on the paragraph, SetNumberingDefinition
and SetNumberingDefinitionByID
both essentially operate on a NumberingDefinition
which is a CT_AbstractNum
. This sets the NumId
on the NumPr
of the paragraph properties PPr.NumPr.NumId
, but they set it equal to the id of the abstractNum
that is passed in.
I believe the PPr.NumPr.NumId
should point to a CT_Num.NumIdAttr
which is an entry in doc.Numbering.X().Num
. CT_Num
then contains the reference to the AbstractNumId
that you want to use.
I don't think the function signatures for the paragraph helpers needs to change since any lookups or creations would take place against the abstractNum
, but the CT_Num
would probably need to be looked up or created based on the abstractNum
so that the CT_Num
could then be referenced.
I noticed in my XML there are two abstractNums
with ids 0
and 1
, but the paragraph references use IDs 1
and 2
which match the <w:num>
tags. The naming also seems to line up.
Let me know if I have something wrong.
from unioffice.
Related Issues (20)
- License error text is confusing HOT 6
- Is this still Open Source software? HOT 3
- Cannot insert table correctly HOT 3
- Feature request: Animations for PowerPoint HOT 1
- nil pointer when convert docx to pdf HOT 9
- Runtime error extracting text from Word document HOT 3
- No text in document after converting a Word document to PDF HOT 3
- How to split a run and/or paragraph while preserving styling HOT 3
- No text extracted from PowerPoint file HOT 2
- how to get the real content contained in the specified bookmark HOT 2
- AppProperties.Pages() doesn't always return the correct number of pages HOT 2
- Convert `.docx` to `.pdf` misses images HOT 2
- How to get the page size for a Word doc? HOT 7
- is there support for adding a comment to a word doc? HOT 1
- Unit tests? HOT 2
- Why do proofreading errors occur HOT 5
- panic: runtime error: index out of range [0] with length 0 while converting docx to pdf HOT 1
- May I ask if there is an implementation for inserting chart elements into pptx? HOT 1
- How to insert a table at a specified location in a word document HOT 2
- Are all Unidoc projects fully open source? HOT 2
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from unioffice.