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

Free Support Forum - aspose.com

Set Visio Shape's Fill data not updated

Hi , I’m trying change the foreground color of attached vdx object. Objects are created using in Visio 2010 floor plane Metric shapes (desk chair). My issue is the shape’s are not getting filled. Please look in to this.


OS : NET Framework version 4 Windows 7 Professional 64 bit)

Code sample is given below

public static void Run()
{
// The path to the documents directory.
string dataDir = RunExamples.GetDataDir_Shapes();

//Load diagram
//Diagram vsdDiagram = new Diagram(dataDir + “RetrieveShapeInfo.vsd”);
Diagram vdxDiagram = new Diagram(dataDir + “Group.vdx”);

//Find a particular shape and update its XForm
foreach (Aspose.Diagram.Shape shape in vdxDiagram.Pages[0].Shapes)
{
foreach (Aspose.Diagram.Prop xchild in shape.Props)
{

if (xchild.Label.Value.ToUpper() == “NAME”)
{
if (xchild.Value.Val.ToUpper() == “SEAT”)
{

shape.Fill.FillForegnd.Value = “#60D6A7”;
shape.Fill.FillPattern.Value = 1;
}
}
}
}

vdxDiagram.Save(dataDir + “Output.vdx”, SaveFileFormat.VDX);

}


Regards

Hi Charith,


Thank you for contacting support. We have evaluated your sample Visio and code against the latest version 6.1.0.1 of the Aspose.Diagram API and figured out that the shapes fill color is not applied. We’ve logged this problem under ticket id DIAGRAMNET-50698 in our bug tracking system. Your post has also been linked to this ticket. We’ll keep you informed regarding any available updates. We’re sorry for the inconvenience caused.

Hi Charith,


In reference to the ticket id DIAGRAMNET-50698, Please use this sample code and let us know how it goes on your side:

[.NET, C#]
// load Visio
Diagram diagram = new Diagram(“C:/temp/Group.vdx”);
// iterate through the shapes
foreach (Aspose.Diagram.Shape shape in diagram.Pages[0].Shapes)
{
// iterate through the shape properties
foreach (Aspose.Diagram.Prop xchild in shape.Props)
{
if (xchild.Label.Value.ToUpper() == “NAME”)
if (xchild.Value.Val.ToUpper() == “SEAT”)
{
//add these lines to set child shape style
if (shape.Type == TypeValue.Group)
{
foreach (Aspose.Diagram.Shape c in shape.Shapes)
{
c.Fill.FillForegnd.Value = “#60D6A7”;
c.Fill.FillPattern.Value = 1;
}
}
//add these lines
shape.Fill.FillForegnd.Value = “#60D6A7”;
shape.Fill.FillPattern.Value = 1;
}
}
}
// save diagram
diagram.Save(“C:/temp/Output.vdx”, SaveFileFormat.VDX);

Thanks Imran It’s working as expected.

Hi Charith,

Thank you for the confirmation. It is nice to hear from you that the problem has been resolved. Please let us know if you require any further assistance, we will be happy to help you.