poi-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Dominik Stadler <dominik.stad...@gmx.at>
Subject Re: Change chart type programmatically?
Date Fri, 15 Jan 2016 11:58:35 GMT
FYI, we also have a helper application OOXMLPrettyPrint as part of the POI
source code which will take a .xlsx/.docx/.pptx/... file and produce a
pretty-printed one (which as Dave stated might not have exactly the same
content any more!). If you run this on both files you can then better
compare these. Best if you combine this with a compare tool that can be
made aware that these files are actually ZIPs and allows to do in-ZIP
comparisons...

Dominik.

On Fri, Jan 15, 2016 at 9:27 AM, David Law <david.law@apconsult.de> wrote:

> Please note: this may be ok for a comparison, but...
> XML DOES NOT NORMALLY CONTAIN NEWLINES
> They result in spurious Text nodes.
> (which most products simply ignore because they are so common)
>
> Javen O'Neals suggestion to convert to canonical is a much better idea.
>
> Workaround: a  newline BEFORE the tag-closing '>' (and '/>' ):
> <html
>     ><body bgcolor="#ffff00"
>         ><h1>Hello world!</h1
>         ><p
>             ><a href="https://poi.apache.org/">XML does not (normally)
> contain newlines</a
>         ></p
>         ><img src="Logo.png" alt="Smiley face" border="1"
>     /></body
> ></html>
>
> P.S. the above is valid XML but NOT Valid XHTML :-)
>
> All the best,
> DaveLaw
>
>
> On 15/01/2016 04:50, Javen O'Neal wrote:
>
>> Find-replace all ">" with ">\n", then run the diff. Alternatively, use a
>> text editor with HTML/XML pretty printing.
>> On Jan 14, 2016 19:40, "Ken Hausam" <kah_12831@yahoo.com.invalid> wrote:
>>
>> Thanks Nick. I'm a novice here. Didn't even know that .xlsx were zips of
>>> XML files.
>>>
>>> After changing chart type, only one file changed: the chart1.xml file
>>> location in the xl/charts/ directory. I've attached the before (line.xml)
>>> and after (stackedbar.xml) files. The diff isn't enormous, but it doesn't
>>> seem trivial either. I couldn't list the actual diff since the XML is all
>>> on one line which makes the diff hard to view as a text diff.
>>>
>>> I already tried a very simple change: changing <c:lineChart> to
>>> <c:barChart> and changing <c:grouping val="standard"/> to <c:grouping
>>> val="stacked"/> . No luck. Excel complained with "file format is not
>>> valid"
>>> when I tried to open it.
>>>
>>> Don't know if it makes a difference, but I was using Mac Excel 2011 to
>>> change the chart type.
>>>
>>> Thanks,
>>> Ken
>>>
>>>
>>>
>>>
>>>
>>>
>>>
>>> On Wednesday, January 13, 2016 2:47 AM, Nick Burch <apache@gagravarr.org
>>> >
>>> wrote:
>>>
>>>
>>> On Sat, 9 Jan 2016, Ken Hausam wrote:
>>>
>>> I am using XSSFChart and associated classes to create a line chart using
>>>> Apache POI. Works great! Thanks. My question is, is there an easy way to
>>>> change the chart type programmatically from a line chart to a stacked
>>>> bar chart? I looked quickly at the CTChart class and associated CT
>>>> classes and noticed that the various chart types had their own class.
>>>> This makes me think that it's not as easy as just flipping a chart type
>>>> attribute somewhere, but figured it couldn't hurt to ask.
>>>>
>>>
>>> I haven't looked at the chart stuff recently, so I can't answer off the
>>> top of my head. What I'd suggest you do is firstly create a simple file
>>> in
>>> Excel, with one sheet, with a few data points, and one style of chart.
>>> Save that. Next, change the type, and save-as that. Next, unzip both
>>> .xlsx
>>> files (rename to .zip and unpack). Now, compare the xml, especially for
>>> sheets and charts, and see what differs. Post a summary of that, and
>>> we'll
>>> help if we can!
>>>
>>> Nick
>>>
>>> ---------------------------------------------------------------------
>>> To unsubscribe, e-mail: user-unsubscribe@poi.apache.org
>>> For additional commands, e-mail: user-help@poi.apache.org
>>>
>>>
>>>
>>>
>>>
>>>
>>> ---------------------------------------------------------------------
>>> To unsubscribe, e-mail: user-unsubscribe@poi.apache.org
>>> For additional commands, e-mail: user-help@poi.apache.org
>>>
>>>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@poi.apache.org
> For additional commands, e-mail: user-help@poi.apache.org
>
>

Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message