Hello!
I am running the code example from
https://github.com/aspose-diagram/Aspose.Diagram-for-.NET/tree/master/Examples →
Working-Diagrams/AutoFitShapesInVisio.cs
with Aspose.Diagram 19.1.0 Version:
public static void Run()
{
// ExStart:AutoFitShapesInVisio
// The path to the documents directory.
string dataDir = RunExamples.GetDataDir_Diagrams();
// Load a Visio diagram
Diagram diagram = new Diagram(dataDir + "BFlowcht - 2.vsdx");
// Use saving options
DiagramSaveOptions options = new DiagramSaveOptions(SaveFileFormat.VSDX);
// Set Auto fit page property
options.AutoFitPageToDrawingContent = true;
// Save Visio diagram
diagram.Save(dataDir + "AutoFitShapesInVisio_out.vsdx", options);
// ExEnd:AutoFitShapesInVisio
}
However, i could not manage to get the saved file fitting to the page like i would do in Microsoft Visio application → Design → Size → Fit to Drawing
I have attached screenshots of input and result files.
Pleas let me know if i am missing something?
Many thanks in advance,
best regards
input.PNG (21.6 KB)
result.PNG (25.8 KB)
@wedoIT-Development
Thanks for contacting support.
We have tested the scenario in our environment and obtained different output as result (i.e. AutoFitShapesInVisio_out.zip (32.0 KB)). However, we did notice that the page was not fit to drawing content as it was obtained using MS Visio.
We have logged this issue as DIAGRAMNET-51613 in our issue tracking system for the sake of correction. We will let you know as soon as some definite updates are available regarding its rectification. Please be patient and spare us little time.
We are sorry for the inconvenience.
Thanks very much and take your time, i am waiting for your update.
@wedoIT-Development
Thanks for your feedback.
We will surely notify you as soon as any update is available regarding ticket resolution.
@wedoIT-Development
We have tested the scenario with Aspose.Diagram for .NET 19.5 and were unable to notice any issue while viewing diagram in Visio 2016. Would you please try with latest version and in case issue still persists, please share a screenshot of the diagram where shapes are getting out of boundaries.
Hi again,
thanks for responding, unfortunately i still can not get it to work. Plesae find the input file “BFlowcht - FROM SUPPORT.vsdx” and the output “AutoFitShapesInVisio_out.vsdx” in the attachement.
I’m running Microsoft Visual Studio 2019 .NET Framework 4 and Aspose.Diagram 19.6.0.
This is the sample code:
namespace Aspose.Diagram.Examples.CSharp.Working_Diagrams
{
public class AutoFitShapesInVisio
{
public static void Run()
{
// ExStart:AutoFitShapesInVisio
// The path to the documents directory.
string dataDir = RunExamples.GetDataDir_Diagrams();
// Load a Visio diagram
Diagram diagram = new Diagram(dataDir + "BFlowcht - FROM SUPPORT.vsdx");
// Use saving options
DiagramSaveOptions options = new DiagramSaveOptions(SaveFileFormat.VSDX);
// Set Auto fit page property
options.AutoFitPageToDrawingContent = true;
// Save Visio diagram
diagram.Save(dataDir + "AutoFitShapesInVisio_out.vsdx", options);
// ExEnd:AutoFitShapesInVisio
}
}
}
Working-Diagrams.zip (65.0 KB)
@wedoIT-Development
Thanks for getting back to us.
We have observed the issue with your sample files and updated the information of earlier logged ticket. We will let you know in case of additional updates. Please spare us little time.
The issues you have found earlier (filed as DIAGRAMNET-51613) have been fixed in Aspose.Diagram for .NET 19.7.
Hi!
Thanks for the update, with Aspose.Diagram version 19.9.0 and the previous sample file it is working as expected. However, with a custom file in our application, it is still not correct (maybe because of Aspose Evaluation version?)
Please find the input and output files attached: Input-Output-Diagrams.zip (215.9 KB)
Sample code is:
public class AutoFitShapesInVisio
{
public static void Run()
{
// ExStart:AutoFitShapesInVisio
// The path to the documents directory.
string dataDir = RunExamples.GetDataDir_Diagrams();
// Load a Visio diagram
Diagram diagram = new Diagram(dataDir + "BFlowcht - CUSTOM WORKFLOW.vsdx");
// Use saving options
DiagramSaveOptions options = new DiagramSaveOptions(SaveFileFormat.VSDX);
// Set Auto fit page property
options.AutoFitPageToDrawingContent = true;
// Save Visio diagram
diagram.Save(dataDir + "AutoFitShapesInVisio_out.vsdx", options);
// ExEnd:AutoFitShapesInVisio
}
}
@wedoIT-Development
We have logged another issue as DIAGRAMNET-51714 in our issue tracking system for further investigation. We will surely let you know as soon as we have additional updates regarding its resolution. Please spare us little time.
We are sorry for the inconvenience.
@wedoIT-Development
Would you please download and try hotfix (Aspose.Diagram for .NET 19.9) which includes fix against DIAGRAMNET-51714. In case you still face any issue, please feel free to let us know.
The issues you have found earlier (filed as DIAGRAMNET-51714) have been fixed in Aspose.Diagram for .NET 19.10.