Bug 51134 - [PATCH] XWPFNumbering and XWPFStyles classes lack a constructor that doesn't call onDocumentRead
Summary: [PATCH] XWPFNumbering and XWPFStyles classes lack a constructor that doesn't ...
Status: RESOLVED FIXED
Alias: None
Product: POI
Classification: Unclassified
Component: XWPF (show other bugs)
Version: 3.7-FINAL
Hardware: All All
: P2 normal (vote)
Target Milestone: ---
Assignee: POI Developers List
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2011-04-28 10:26 UTC by Mike McEuen
Modified: 2011-07-08 13:13 UTC (History)
0 users



Attachments
Changes in tar.gz format (12.47 KB, application/x-tar)
2011-05-20 21:40 UTC, Mike McEuen
Details
Diff (9.64 KB, patch)
2011-05-20 21:40 UTC, Mike McEuen
Details | Diff
Unit tests for creating and adding Numberings and Styles to a new document. (2.05 KB, patch)
2011-07-06 20:12 UTC, Mike McEuen
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Mike McEuen 2011-04-28 10:26:36 UTC
When creating a new Docx document, it is impossible to add a new numbering. The only option for creating an XWPFNumbering object is by reading in a document that already has a Numbering section. It was suggested on the mailing list to create an additional method on XWPFDocument that will add the numbering, and then implement the appropriate constructor on XWPFNumbering.

Here's the original thread:
http://mail-archives.apache.org/mod_mbox/poi-user/201104.mbox/%3Calpine.DEB.2.00.1104280351400.29085@urchin.earth.li%3E
Comment 1 Mike McEuen 2011-05-20 21:40:35 UTC
Created attachment 27042 [details]
Changes in tar.gz format

Allow new XWPFDocuments to create Numbering and Styles elements from scratch. Previously, these elements could only be modified if read in from existing an existing docx. This patch also contains new methods to XWPFStyles to set default spelling language and font properties. These changes can be moved to a different patch/bug if necessary.
Comment 2 Mike McEuen 2011-05-20 21:40:59 UTC
Created attachment 27043 [details]
Diff
Comment 3 Nick Burch 2011-05-27 13:25:55 UTC
Thanks, committed in r1128296.

Any chance you could knock up a quick unit test for this? A test that springs to mind is to create a doc, add the numbering and styles and set these. Then, save it and re-open it in XWPF, and check the expected things are all there
Comment 4 Mike McEuen 2011-07-06 20:12:31 UTC
Created attachment 27268 [details]
Unit tests for creating and adding Numberings and Styles to a new document.

As per Nick's suggestion, here are some unit tests for the functionality I added.
Comment 5 Nick Burch 2011-07-08 13:13:11 UTC
Thanks, unit tests added in r1144303.