Date: prev next · Thread: first prev next last
2015 Archives by date, by thread · List index


On 15.05.2015 22:03, Jan Rheinländer wrote:
Hi,

I'm trying to insert an XYDiagram into a Writer (!) document by code.
But I can't figure out how to get any data into it. All the examples on
the web are always for Calc, never for Writer. The code I have got is below.

  // Create two new sequences based on the two first default sequences,
setting the roles correctly for an XYDiagram
  Reference < ::com::sun::star::chart2::XChartDocument >
chart(xEOS->getEmbeddedObject(), UNO_QUERY_THROW);
  chart->createInternalDataProvider(true);
  Reference< XDataProvider > dataProvider = chart->getDataProvider();

===>
===> Here the problems start: This gives an "unsatisified query" error
===>
  // Create two sequences
  Sequence< Reference< XLabeledDataSequence > > sequences(2);
  sequences[0] = Reference <
::com::sun::star::chart2::data::XLabeledDataSequence >
(cDocMSF->createInstance(OU("com.sun.star.chart2.data.LabeledDataSequence")),
UNO_QUERY_THROW);

there is a service SwChartLabeledDataSequence but apparently it's not
possible to create it from the writer document factory.

it is created from SwChartDataProvider::createDataSource(), which takes
parameters like "DataRowSource", "FirstCellAsLabel",
"CellRangeRepresentation", "SequenceMapping", "ChartOleObjectName".

perhaps the "dataProvider" variable above would work?

i don't really know how any of this chart stuff works but here's the source:

http://opengrok.libreoffice.org/xref/core/sw/source/core/unocore/unochart.cxx


Context


Privacy Policy | Impressum (Legal Info) | Copyright information: Unless otherwise specified, all text and images on this website are licensed under the Creative Commons Attribution-Share Alike 3.0 License. This does not include the source code of LibreOffice, which is licensed under the Mozilla Public License (MPLv2). "LibreOffice" and "The Document Foundation" are registered trademarks of their corresponding registered owners or are in actual use as trademarks in one or more countries. Their respective logos and icons are also subject to international copyright laws. Use thereof is explained in our trademark policy.