Quantcast

Re: svn commit: r1795002 [3/3] - in /poi/trunk: ./ src/java/org/apache/poi/ss/usermodel/ src/ooxml/java/org/apache/poi/xssf/model/ src/ooxml/java/org/apache/poi/xssf/usermodel/ src/ooxml/testcases/org/apache/poi/xssf/usermodel/ src/resources/ooxml/org/apac...

classic Classic list List threaded Threaded
3 messages Options
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: svn commit: r1795002 [3/3] - in /poi/trunk: ./ src/java/org/apache/poi/ss/usermodel/ src/ooxml/java/org/apache/poi/xssf/model/ src/ooxml/java/org/apache/poi/xssf/usermodel/ src/ooxml/testcases/org/apache/poi/xssf/usermodel/ src/resources/ooxml/org/apac...

Greg Woolsey-2
Argh, fat fingered it before I could type my comment.

This is initial read-only API support for Table Styles, including the
specification defined built-in table and pivot table styles, issue #61085.

This includes some new SS interfaces, including one to start to bridge
common functionality between conditional formatting rules and table style
definitions that both rely on the same underlying CTDfx element.

There is a performance/memory hit the first time the built-in table style
Enum is accessed, as it loads the spec style definitions.  My
implementation is really ugly imho, but it works.  I couldn't figure out a
way to get XMLBeans factories on the CT classes to initialize the full
objects from an XML fragment, only top-level documents, so I fake up a
styles.xml for each built-in style found, and parse those.  Takes about 2.5
seconds on my system, which is why I made it lazy.

It can be initialized explicitly through a static method, if an app desires
to take the hit up front rather than on first access.

More will be coming to help determine which table style elements apply to a
given table cell, since it is 1-N, with a precedence order for property
application.

On Fri, May 12, 2017 at 11:01 AM <[hidden email]> wrote:

> Propchange:
> poi/trunk/src/resources/ooxml/org/apache/poi/xssf/usermodel/presetTableStyles.xml
>
> ------------------------------------------------------------------------------
>     svn:eol-style = native
>
> Added: poi/trunk/test-data/spreadsheet/tableStyle.xlsx
> URL:
> http://svn.apache.org/viewvc/poi/trunk/test-data/spreadsheet/tableStyle.xlsx?rev=1795002&view=auto
>
> ==============================================================================
> Binary file - no diff available.
>
> Propchange: poi/trunk/test-data/spreadsheet/tableStyle.xlsx
>
> ------------------------------------------------------------------------------
>     svn:mime-type = application/octet-stream
>
> Added: poi/trunk/test-data/spreadsheet/~$tableStyle.xlsx
> URL:
> http://svn.apache.org/viewvc/poi/trunk/test-data/spreadsheet/%7E%24tableStyle.xlsx?rev=1795002&view=auto
>
> ==============================================================================
> Binary file - no diff available.
>
> Propchange: poi/trunk/test-data/spreadsheet/~$tableStyle.xlsx
>
> ------------------------------------------------------------------------------
>     svn:mime-type = application/octet-stream
>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [hidden email]
> For additional commands, e-mail: [hidden email]
>
>
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: svn commit: r1795002 [3/3] - in /poi/trunk: ./ src/java/org/apache/poi/ss/usermodel/ src/ooxml/java/org/apache/poi/xssf/model/ src/ooxml/java/org/apache/poi/xssf/usermodel/ src/ooxml/testcases/org/apache/poi/xssf/usermodel/ src/resources/ooxml/org/apac...

Nick Burch-2
On Fri, 12 May 2017, Greg Woolsey wrote:
> Argh, fat fingered it before I could type my comment.

No worries! We all do it eventually... Don't forget you can edit the
message later:
http://stackoverflow.com/questions/2184317/change-svn-commit-message-retroactively

>  My implementation is really ugly imho, but it works.  I couldn't figure
> out a way to get XMLBeans factories on the CT classes to initialize the
> full objects from an XML fragment, only top-level documents, so I fake
> up a styles.xml for each built-in style found, and parse those.  Takes
> about 2.5 seconds on my system, which is why I made it lazy.

I *think* I got that working in the past elsewhere. If you let me know
which class has the faking in, and the best unit test to use to check
with, I can try and have a go!

Nick

---------------------------------------------------------------------
To unsubscribe, e-mail: [hidden email]
For additional commands, e-mail: [hidden email]

Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: svn commit: r1795002 [3/3] - in /poi/trunk: ./ src/java/org/apache/poi/ss/usermodel/ src/ooxml/java/org/apache/poi/xssf/model/ src/ooxml/java/org/apache/poi/xssf/usermodel/ src/ooxml/testcases/org/apache/poi/xssf/usermodel/ src/resources/ooxml/org/apac...

Greg Woolsey
Thanks!   It's in

XSSFBuiltinTableStyle.init()
and
TestTableStyles.testBuiltinStyleInit()

tests it.

The issue is having to do something custom in the first place, since the
specification XML isn't quite the same format as styles.xml.  I documented
it in the init() method.

I parse the whole file at once into a Document, and then iterate on the
child element nodes.  For each one, we need a CTDxfs and a CTTableStyles
built from the immediate child nodes of those types.  When I tried it it
didn't throw any errors, and the toString() values for the objects showed
the right XML, but none of the getters returned any values from that XML,
so the factory didn't actually parse the node tree.

Thus my hack to convert those nodes back to XML text, wrap them in
boilerplate, and parse it as a styles.xml.

Would save time and memory at least if I went to the trouble of just
streaming the XML or even text and checking for style boundaries, but I
went with faster and easier to start with.

Greg

On Fri, May 12, 2017 at 12:12 PM Nick Burch <[hidden email]> wrote:

> On Fri, 12 May 2017, Greg Woolsey wrote:
> > Argh, fat fingered it before I could type my comment.
>
> No worries! We all do it eventually... Don't forget you can edit the
> message later:
>
> http://stackoverflow.com/questions/2184317/change-svn-commit-message-retroactively
>
> >  My implementation is really ugly imho, but it works.  I couldn't figure
> > out a way to get XMLBeans factories on the CT classes to initialize the
> > full objects from an XML fragment, only top-level documents, so I fake
> > up a styles.xml for each built-in style found, and parse those.  Takes
> > about 2.5 seconds on my system, which is why I made it lazy.
>
> I *think* I got that working in the past elsewhere. If you let me know
> which class has the faking in, and the best unit test to use to check
> with, I can try and have a go!
>
> Nick
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [hidden email]
> For additional commands, e-mail: [hidden email]
>
>
Loading...