Free Support Forum - aspose.com

Wrong shape color/gradient when saving

In the diagram generated by the following code, when saved in .EMF, .VDX, or .VSDX, creating Diagram instances based on newer file format always produces wrong output. Furthermore, even when Diagram instance is created based on older file format, saving in .EMF will produces wrong gradient (It should be noted that a manual copy & paste as EMF in Word produces correct gradient). Can you help to check and fix ? The files are attached for your convenience.


public static void Test3()

{

string[] inputFileNames = new string[] { // When saved later, it seems that:

"_Circle.vsdx", // CORRECT: . WRONG: .emf, color & gradient is lost; .vdx, circle is now shown; .vsdx, color & gradient is lost.

"_Circle_ReSavedFromVSDX.vsd", // CORRECT: .vdx, .vsdx. WRONG: .emf, gradient is wrong.

"_Circle_Stencil.vssx", // CORRECT: . WRONG: .emf, color & gradient is lost; .vdx, circle is now shown; .vsdx, color & gradient is lost.

"_Circle_Stencil_ReSavedFromVSSX.vss" // CORRECT: .vdx, .vsdx. WRONG: .emf, gradient is wrong.

};

foreach(string inputFileName in inputFileNames)

{

// Create a new diagram

Diagram diagram = new Diagram(inputFileName);

// Add a new circle shape with off-set radial gradient

long shapeId = diagram.AddShape(4.25, 5.5, 2, 2, @"Ball, Line", 0);

Shape shape = diagram.Pages[0].Shapes.GetShape(shapeId);

shape.Text.Value.Add(new Txt(@"Circle text."));

// Save the new diagram

string outputDiagramPath = System.Reflection.MethodBase.GetCurrentMethod().DeclaringType + "." + System.Reflection.MethodBase.GetCurrentMethod().Name + inputFileName;

diagram.Save(outputDiagramPath + ".vsdx", SaveFileFormat.VSDX);

diagram.Save(outputDiagramPath + ".vdx", SaveFileFormat.VDX);

diagram.Save(outputDiagramPath + ".emf", SaveFileFormat.EMF);

}

}

Hi Jiaguo,


Thank you for contacting support. We managed to replicate the said problem as below:

DIAGRAMNET-51071: The gradient color of the shape is not being preserved on saving in VSDX
DIAGRAMNET-51072: The gradient color of the shape is not being preserved on saving in EMF
DIAGRAMNET-51073: Incomplete rendering of the circle shape on saving in VDX
DIAGRAMNET-51074: The wrong gradient of the circle shape on saving in EMF
DIAGRAMNET-51075: The gradient color of circle shape is not shown on saving in VSDX
DIAGRAMNET-51076: The gradient color of circle shape is not shown on saving in EMF
DIAGRAMNET-51077: Incomplete rendering of the circle shape on saving in VDX
DIAGRAMNET-51078: The wrong gradient of the circle shape on saving in EMF

Your post has also been linked to these tickets. We’ll keep you informed regarding any available updates. We’re sorry for the inconvenience caused.

Hi Jiaguo,


Thank you for being patient. We have a good news for you that the ticket IDs DIAGRAMNET-51071 and DIAGRAMNET-51075 have now been resolved. If there is no issue in the QA phase, then their fixes will be included in the next version 16.12.0 of Aspose.Diagram for .NET API. We’ll inform you via this forum thread as soon as the new release is published.

Hi Jiaguo,


Thank you for being patient. We have a good news for you that the ticket IDs DIAGRAMNET-51073 and DIAGRAMNET-51077 have now been resolved. If there is no issue in the QA phase, then their fixes will be included in the next version 16.12.0 of Aspose.Diagram for .NET API. We’ll inform you via this forum thread as soon as the new release is published.

Hi Jiaguo,


Thank you for being patient. In reference to the ticket IDs DIAGRAMNET-51071, DIAGRAMNET-51073, DIAGRAMNET-51075 and DIAGRAMNET-51077, please download and use the latest Hotfix version: Aspose.Diagram for .NET 16.11.2.0. Please also let us know how that goes on your side.

First of all, many thanks for your efforts !
IDs DIAGRAMNET-51071, DIAGRAMNET-51073, DIAGRAMNET-51075 and DIAGRAMNET-51077 should be considered fixed based on my testing. :slight_smile: That is to say, one can load from either old Visio format such as .vdx or new Visio format such as .vsdx and then save to either old Visio format such as .vdx or new Visio format such as .vsdx and keep the gradient.

Nevertheless, I am sorry but I do not think your fix solves the root problem.

Can you please help to check the attachement and comment ?:
cystein_aspose.emf is obtained using Apose to save cystein.vdx to .emf format.
cystein_visio_automation.emf is obtained using Apose to save cystein.vdx to .emf format.
cystein_emf_insert_to_word.docx is a simple Word document with these two .emf inserted.

The most noticeable problems are two places:
(1) Gradient of the circles is wrong (or lost).
(2) Something about the trapezoids is strangely wrong (twisted ?).

Many thanks for your efforts.

Hi Jiaguo,


Thank you for the details. You’re generating one DOCX and two EMF files from a single VDX diagram. Please provide us all your code examples and VSDX samples as well. We could not notice any trapezoid shape in the source VDX diagram. Please highlight the second issue with the help of a screenshot. Please create and attach separate zip archives for each use case and include complete details, e.g. source Visio, code example and output document. It’ll help us to be more specific. Your response is awaited.

There should be no sample code needed:

If you would open .vdx with Aspose Diagram API, (there is nothing special to do here), save with to .emf, the output is wrong.
If you would open .vdx with Visio 2016 and save to .emf, the output is perfect.

The Word document is not generated by programming. I inserted the .emf files manually for your convenience.

If you would do as described the above, you could see the difference immediately, as also evident from the Word document.

If screenshot is still needed, I would have to make it tomorrow and upload.

Hi Jiaguo,


Thank you for the details. We managed to replicate the said problems as below:

DIAGRAMNET-51111: Gradient fill of the circles is wrong when converting a VDX to EMF
DIAGRAMNET-51112: Trapezoid shapes are not being rendered properly on converting a VDX to EMF
DIAGRAMNET-51113: The text of the circles is misplaced on converting a VDX to EMF

Your post has also been linked to these tickets. We’ll keep you informed regarding any available updates. We’re sorry for the inconvenience caused.

You may also provide us your problematic VSDX samples. We recommend our clients to post each their problematic diagram. We’ll investigate and reply you appropriately.

Many thanks for your efforts to reproduce !

> You may also provide us your problematic VSDX samples. We recommend our clients to post each their problematic diagram. We'll investigate and reply you appropriately.

As you have recorded, my problems now concern VDX & emf :)

Hi Jiaguo,


Thank you for the confirmation. We’ll let you know once any update is available from the logged ticket IDs.

The issues you have found earlier (filed as DIAGRAMNET-51071;DIAGRAMNET-51075;DIAGRAMNET-51073;DIAGRAMNET-51077) have been fixed in Aspose.Diagram for .NET 16.12.0.


This message was posted using Notification2Forum from Downloads module by Aspose Notifier.

@comingnine,

The linked ticket IDs DIAGRAMNET-51112 and DIAGRAMNET-51113 have been resolved and will be included in next version 18.4 of Aspose.Diagram for .NET API. We will notify you once the next version is published.

@comingnine,

The linked ticket IDs DIAGRAMNET-51112 and DIAGRAMNET-51113 have been fixed. Please download and try the latest hotfix version 18.3.1 of Aspose.Diagram for .NET API.

The issues you have found earlier (filed as DIAGRAMNET-51112,DIAGRAMNET-51113) have been fixed in Aspose.Diagram for .NET 18.4. This message was posted using BugNotificationTool from Downloads module by imran.rafique

The issues you have found earlier (filed as DIAGRAMNET-51072,DIAGRAMNET-51074,DIAGRAMNET-51076) have been fixed in Aspose.Diagram for .NET 20.7.