You can please set the position of text using following code snippet:
// set its horizontal position
connector.getControls().get(0).getX().setValue(0.987);
// set its vertical position
connector.getControls().get(0).getY().setValue(0.987);
You can please set the position of text using following code snippet:
// set its horizontal position
connector.getControls().get(0).getX().setValue(0.987);
// set its vertical position
connector.getControls().get(0).getY().setValue(0.987);
Dear Asad getControls did not work for me I was able to move it in x axis to some point using connectors.get(counter2).getTextBlock().setLeftMargin(margin4);
but the margin could not move after certain point . it works between 0 and -ve nos
but when margin is set postive it stops working.
I am able to move the text and in y axis using connectors.get(counter2).getTextBlock().setTopMargin(margin1);
for example in the diagram bellow I wanted to move the text to the left but I could not move it Capture.PNG (1.5 KB)
When I try to move it to left that is by changing the margin value to postive it looks like the following diagram Capture1.PNG (2.5 KB)
Please try using following code snippet:
dg.getPages().get(0).getShapes().getShape(11).getTextXForm().getTxtPinX().setValue(2);
dg.getPages().get(0).getShapes().getShape(11).getTextXForm().getTxtPinY().setValue(2);
Thank you Asad we will try the code you sent us .
Currently we require urgent support on using the library to draw into multiple pages.
i.e for example
Diagram dg = new Diagram(dirPath );
// Access the Page-2 of the template Visio file.
Page pg = dg.getPages().getPage(“Page-2”);
// Add Master Shapes into Aspose Diagram object from SampleMasterShapes Stencil.
// dirpath2 is path to stencil
dg.addMaster(dirPath2 , “Rectangle”);
// Add Rectangle shape from master Rectangle shape and assign it name.
long shId = dg.addShape(2.70, 7.54, 1.5, 1, “Rectangle”, 0);
pg.getShapes().getShape(shId).setName(“shpRect”);
it seems page-2 is not getting the shapes the last line always fails.
that is pg.getShapes().getShape(shId).setName(“shpRect”);
is there anything we have to do to be able to draw page -2
But it works with out a problem if we are drawing it page-1. some how it seems that Stencil are not avilable to use in page-2
Hi as mentioned above Can you please let us know how we can draw into different pages other than page -1 ?
Could you kindly share the sample Diagram and Stencil files with us with which you are working. We will test the scenario in our environment and address it accordingly. You can also check Retrieve, Get, Copy and Insert a Page articles in API documentation if that helps.
stencil_diag.zip (641.6 KB)
@asad.ali
W e thank you for your continued assistance I have attached stencil and drawing files .
As new customers we are checking capabilities of the library. The current problem we faced i.e drawing into multiple visio pages is highly time sensitive , we thank you in advance for your speedy assistance .
Thanks for sharing the sample files.
The issue seems related to following line of code:
long shId = dg.addShape(2.70, 7.54, 1.5, 1, "Rectangle", 0);
Where you are using last argument (PageIndex) as 0 whereas it should be 1 for Page-2. Please note that the Page Indexes start from 0. Please try replacing above line with following one:
long shId = dg.addShape(2.70, 7.54, 1.5, 1, "Rectangle", 1);
On the above you have mentioned I can use connector.getControls().get(0).getX().setValue(0.987);
to move the lables horizontally .
Can you please tell me the purpose of 0 (zero) value in .get(0) ?
What does zero signify ?