Free Support Forum - aspose.com

Identify chart shapes in a Word document

Is the Aspose Words API able to distinguish charts from other shapes in a Word document? Word interop provides a way to detect chart shapes via the InLineShape.HasChart property, but we are unable to find corresponding functionality in Aspose Words.

Please advise.

Hi Lloyd,

A new feature request to support this feature has been logged into our issue tracking system as WORDSNET-11858. We will keep you updated on this issue in this thread.

Best Regards,

The issues you have found earlier (filed as WORDSNET-11858) have been fixed in this .NET update and this Java update.


This message was posted using Notification2Forum from Downloads module by aspose.notifier.
<span style="font-size:10.0pt;font-family:"Arial","sans-serif";

mso-fareast-font-family:“Times New Roman”;mso-ansi-language:EN-US;mso-fareast-language:
JA;mso-bidi-language:AR-SA">Is it possible to convert charts to images within the document?

Please advise.
<!–[if gte mso 9]>
<w:WordDocument>
<w:View>Normal</w:View>
<w:Zoom>0</w:Zoom>
<w:TrackMoves/>
<w:TrackFormatting/>
<w:PunctuationKerning/>
<w:ValidateAgainstSchemas/>
<w:SaveIfXMLInvalid>false</w:SaveIfXMLInvalid>
<w:IgnoreMixedContent>false</w:IgnoreMixedContent>
<w:AlwaysShowPlaceholderText>false</w:AlwaysShowPlaceholderText>
<w:DoNotPromoteQF/>
<w:LidThemeOther>EN-US</w:LidThemeOther>
<w:LidThemeAsian>JA</w:LidThemeAsian>
<w:LidThemeComplexScript>X-NONE</w:LidThemeComplexScript>
<w:Compatibility>
<w:BreakWrappedTables/>
<w:SnapToGridInCell/>
<w:WrapTextWithPunct/>
<w:UseAsianBreakRules/>
<w:DontGrowAutofit/>
<w:SplitPgBreakAndParaMark/>
<w:EnableOpenTypeKerning/>
<w:DontFlipMirrorIndents/>
<w:OverrideTableStyleHps/>
</w:Compatibility>
<m:mathPr>
<m:mathFont m:val=“Cambria Math”/>
<m:brkBin m:val=“before”/>
<m:brkBinSub m:val="–"/>
<m:smallFrac m:val=“off”/>
<m:dispDef/>
<m:lMargin m:val=“0”/>
<m:rMargin m:val=“0”/>
<m:defJc m:val=“centerGroup”/>
<m:wrapIndent m:val=“1440”/>
<m:intLim m:val=“subSup”/>
<m:naryLim m:val=“undOvr”/>
</m:mathPr></w:WordDocument>
<![endif]–><!–[if gte mso 10]>

/* Style Definitions */ table.MsoNormalTable {mso-style-name:"Table Normal"; mso-tstyle-rowband-size:0; mso-tstyle-colband-size:0; mso-style-noshow:yes; mso-style-priority:99; mso-style-parent:""; mso-padding-alt:0in 5.4pt 0in 5.4pt; mso-para-margin:0in; mso-para-margin-bottom:.0001pt; mso-pagination:widow-orphan; font-size:10.0pt; font-family:"Times New Roman","serif";}

<![endif]–>

Hi Lloyd,


Thanks for your inquiry. You can use the following code to convert Chart to Image:

Document doc = new Document(MyDir + @“in.docx”);

DocumentBuilder builder = new DocumentBuilder(doc);

NodeCollection shapes = doc.GetChildNodes(NodeType.Shape, true);

foreach (Shape shape in shapes)

{

if (shape.HasChart)

{

using (MemoryStream stream = new MemoryStream())

{

ShapeRenderer renderer = shape.GetShapeRenderer();

renderer.Save(stream, new ImageSaveOptions(SaveFormat.Png));

builder.MoveTo(shape);

builder.InsertImage(stream);

}

}

}

int shapesCount = shapes.Count;

for (int i = 0; i < shapesCount; i++)

{

Shape s = (Shape)shapes[i];

if (s.HasChart)

{

s.Remove();

}

}

doc.Save(MyDir + @“15.6.0.docx”);


I hope, this helps.

Best regards,

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