Queries while converting visio code to aspose (.net)

Hi, I am have a visio code snippet which generates a vsdx file.
I need to generate the vsdx file using aspose as well. I extracted an interface and kept the code of main class intact.

So now that interface has two implementations, one for interop visio and second for aspose.

There are certain code functions which I fail to find in aspose.

Please help me on that.

  1. Shape s = interopPage.DrawRectangle(x1, y1, x2, y2).
    I did not find any method as draw rectangle in Aspose Page’s implementation.

  2. The centerDrawing method present in interop visio page. How can I get that functionality?

  3. The Pagesheet for master present in visio. What does it map to in aspose?

Will keep on posting new queries on this thread as I go further in my implementation.

Thank you in advance

@y0808

We are checking for the related information against your inquiry and will get back to you shortly.

Thank you
Also is there any way to track ActivePage and Active window. As there is a property in visio application?

@y0808

We have added this method in the latest fix i.e. 21.1.1. You may please use this fix in order to use the method:

public long DrawRectangle(double pinX, double pinY, double width, double height);

This method will be included in 21.2v and higher versions of the API as well.

You may use diagram.Masters[0].PageSheet or diagram.Pages[0].PageSheet.

We have added a feature request in our issue tracking system as DIAGRAMNET-51986 in order to implement this method. We will notify you as soon as the ticket is resolved. Please give us some time.

Please check below section of the API documentation which offers all the information about handling with Diagram Pages using the API.

@y0808

In order to implement a method to get ActivePage, we have logged a feature request as DIAGRAMNET-51987 in our issue tracking system. We will inform you as soon as it is implemented. Please give us some time.

There are VisioApp.ActivePage.PageSheet.CellsSRC(CShort(visSectionObject), CShort(visRowPage), CShort(visPageWidth)).FormulaU
and VisioApp.ActivePage.PageSheet.CellsSRC(CShort(visSectionObject), CShort(visRowPage), CShort(visPageWidth)).Result

The cell here signifies “PageWidth” for page. I dont find a way to set the PageWidth etc.
Other fields that I need to set are PageHeight, PrintPageOrientation, LineAdjustFrom.
How can I do this in Aspose?

@y0808

Please check below Classes in the API Reference related to your needs:

A ticket as DIAGRAMNET-51988 has been further logged in our issue tracking system for the sake of investigation. We will let you know as soon as the ticket is resolved. Please give us some time.

image.png (501.8 KB)

I see that you have closed the ticket but there is no way to set the properties.
This is what I find in page props. And this is how it is suggested to be done in one of the posts… How to set the page size and orientation? - #2 by imran.rafique

Could you please give me a code snippet in .net so as to how to use PageSize from pagesheet?

@y0808

You can please use the below code snippet to get height and width of the pages:

var w = diagram.Pages[0].PageSheet.PageProps.PageWidth;
var h = diagram.Pages[0].PageSheet.PageProps.PageHeight;

Yes, I saw that but these properties have only getters and I am not able to set new values to them. How can I set these values?

@y0808

You may please set it by using Value property like below:

diagram.Pages[0].PageSheet.PageProps.PageWidth.Value = 200;

There is a method _shape.XYToPage(x, y, out xprime, out yprime); in visio. is there any equivalent method in aspose?

Also , I am trying to save a diagram but when I open vsdx file in visio I see no stencils or pages.

image.png (422.6 KB)

Masters Uploaded: image.png (53.3 KB)

Pages Created: image.png (46.4 KB)

And the visio Generated is :image.png (389.2 KB)

@y0808

You can calculate PinX and PinY values of the sub shapes using Aspose.Diagram. Please check the below topic(s) in the API documentation for more information:

Could you please share the sample stencil file(s) along with complete code snippet with us. We will test the scenario in our environment and address it accordingly.

Hello,

I cannot share my code. It is dependent on various other components as well. So if we can schedule a zoom session any time.
We have a license and support as well from Aspose.Diagram. It would be helpful if we can have a call. There are certain things that I am not able to address on tickets as well.

The issues you have found earlier (filed as DIAGRAMNET-51986,DIAGRAMNET-51987) have been fixed in this update. This message was posted using Bugs notification tool by philip.zhou

Hello, Also when I change one InheritProps and then try to change second one the previous one gets set back to default. As a new object always gets created for Inherit props and therefor when I do a GetProp a new object with default value is returned

@y0808

Please note that we encourage providing support via our dedicated support forums and we are afraid that a Zoom Meeting or Session would not be possible. In case you have subscription of paid support, you can create an inquiry there as well in order to get your issues fixed on urgent basis (if you find some). Also, please try to share some screenshots of the issue that you are noticing by opening the generated diagram in MS Visio. We will further proceed to assist you accordingly.

We tested the scenario using following sample code snippet and were unable to notice any issue:

Aspose.Diagram.Diagram diagram = new Diagram.Diagram(dataDir + "Simple Process.vsdx");
Aspose.Diagram.Page page = diagram.Pages[0];
foreach (Aspose.Diagram.Shape shape in page.Shapes)
{
 foreach (Aspose.Diagram.Prop prop in shape.InheritProps)
 {
  prop.Name = "Something new";
  prop.Label.Value = "Something more new";
 }
}

Please share some sample diagram and more details to the issue so that we can try to replicate it at our side and address it accordingly.