We're sorry Aspose doesn't work properply without JavaScript enabled.

Free Support Forum - aspose.com

Customize chart settings or read existing chart?

Is there a way to customize the words chart such as change the series colors? I don’t see any examples in the words Chart documentation around changing series colors. If not is there a way to get an existing chart from an existing words document?

Hi there,

Thanks for your inquiry. Unfortunately, Aspose.Words does not provide APIs to get or set chart series' color. However, we have logged this feature request as WORDSNET-12640 in our issue tracking system. You will be notified via this forum thread once this feature is available. We apologize for your inconvenience.
wbd.net:
If not is there a way to get an existing chart from an existing words document?
Could you please share some detail about this query? We will then provide you more information on this.

Thanks for the response.


My query about getting an existing chart from an existing words document was for the purpose of using it as a template where a word document could be created manually with a manually styled chart and then that chart could be populated with data and saved to a new document file? That would get around the need right now to have api settings for changing chart colors.
Hi there,

Thanks for sharing the detail. The chart in the Word documents is imported into Shape node in Aspose.Words' DOM. Please use NodeImporter.ImportNode method to import a node from one document into another.

Document docChart = new Document(MyDir + "in.docx");

Shape shape = (Shape)docChart.GetChild(NodeType.Shape, 0, true);

Document doc = new Document();

if (shape.HasChart)

{

NodeImporter importer = new NodeImporter(docChart, doc, ImportFormatMode.KeepSourceFormatting);

Node newNode = importer.ImportNode(shape, true);

doc.FirstSection.Body.FirstParagraph.AppendChild(newNode);

}


If you face any issue, please share your template, input and expected output documents here for our reference. We will then provide you more information about your query along with code.

The issues you have found earlier (filed as WORDSNET-12640) have been fixed in this Aspose.Words for .NET 21.6 update and this Aspose.Words for Java 21.6 update.