poi-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From bugzi...@apache.org
Subject DO NOT REPLY [Bug 48042] Cannot save changes made to a chart
Date Wed, 28 Oct 2009 13:00:06 GMT

Yegor Kozlov <yegor@dinom.ru> changed:

           What    |Removed                     |Added
             Status|NEW                         |RESOLVED
         Resolution|                            |INVALID

--- Comment #2 from Yegor Kozlov <yegor@dinom.ru> 2009-10-28 06:00:03 UTC ---
There are two errors:

(1) PackagePart's output stream must be closed. 

(2) bodyPr is a required element in CT_TextBody, see of the OOXML

The correct code to set chart title is as follows:

  ChartSpaceDocument docChartSpace =
  CTChartSpace xChartSpace =
  CTChart xChart = xChartSpace.getChart();

  CTTitle xTitle = xChart.addNewTitle();

  CTTextBody ctBody = xTitle.addNewTx().addNewRich();
  ctBody.addNewBodyPr(); //required
  ctBody.addNewP().addNewR().setT("new title");
  XmlOptions oOptions = new XmlOptions();

  PackagePart part = poixmlpartDrawing.getPackagePart();
  OutputStream out = part.getOutputStream();
  docChartSpace.save(out, oOptions);
  out.close(); //must close


Configure bugmail: https://issues.apache.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug.

To unsubscribe, e-mail: dev-unsubscribe@poi.apache.org
For additional commands, e-mail: dev-help@poi.apache.org

View raw message