How to get '.vsdx' shape color


#1

i use aspose.diagram for java,have a problem,i want get shape color,but the ‘.vsdx’ file get color empty.
my code is:
String lineColor = shape.getLine().getLineColor().getValue();String fillColor = shape.getFill().getFillForegnd().getValue()
`
both of this is empty


#2

@Delaba

Could you please share your sample Diagram file with us. We will test the scenario in our environment and address it accordingly.


#3

image.png (9.9 KB)
i can’t upload ‘vsdx’,please look the png. i want get the shape color and the line width,i don’t know use api is correct,if possinle, you can give me the correct api or demo.
thanks.


#4

@Delaba

You may add your .vsdx to ZIP Archive and share with us by attaching it with your post.


#5

newfile.zip (28.1 KB)


#6

@Delaba

We tried to extract the file from archive you shared, but it looked like the archive was corrupt. However, would you please try using following code snippet in order to get shape color:

Aspose.Diagram.Diagram diagram = new Diagram.Diagram(dataDir + "Shape_With_Date.vsdx");
foreach(Aspose.Diagram.Shape shape in diagram.Pages[0].Shapes)
{
  var fill = shape.InheritFill.FillBkgnd.Value;
}

You can further explore different properties of shape.InheritFill in above code snippet to extract values. In case you still face any issue, please feel free to let us know. You can also upload your sample file to Dropbox or Google Drive and share the link with us.


#7

thanks,i try it.