Referring the example in http://jexcel-support.teamdev.com/samples/merge-and-insert
File file = new File("logo.jpg"); BStr bStr = new BStr(file.getAbsolutePath()); iPictures.insert(bStr,unspecifiedParameter);
When adding an image to a worksheet, is there a way to specify X,Y coordinates and image width and image height?
Need to assign the result of insert operation and then set position parameters on Picture object.
e.g.
Picture p = iPictures.insert(bStr,unspecifiedParameter);
p.setLeft(new DoubleFloat(xPositionOffset));
p.setTop(new DoubleFloat(yPositionOffset));
Hi,
It is possible to configure X and Y coordinates for the inserted picture.
The following sample code demonstrates how to perform this:
Picture picture = iPictures.insert(new BStr("C:\\picture.png"), Variant.createUnspecifiedParameter());
picture. setTop(new DoubleFloat(100));
picture. setLeft(new DoubleFloat(50));
Please let us know if you have any further questions.
Sincerely,
Anna
--
You received this message because you are subscribed to the Google Groups "JExcel Forum" group.
To unsubscribe from this group and stop receiving emails from it, send an email to jexcel-forum...@teamdev.com.
To view this discussion on the web visit https://groups.google.com/a/teamdev.com/d/msgid/jexcel-forum/6381baf6-a24c-4f73-849b-2e711818a723%40teamdev.com.
Picture picture = iPictures.insert(new BStr("C:\\picture.png"), Variant.createUnspecifiedParameter());
picture.setTop(new DoubleFloat(100));
picture.setLeft(new DoubleFloat(50));
picture.setWidth(new DoubleFloat(500));
picture.setHeight(new DoubleFloat(500));
Hi,
It is possible to configure X and Y coordinates for the inserted picture.
The following sample code demonstrates how to perform this:
Picture picture = iPictures.insert(new BStr("C:\\picture.png"), Variant.createUnspecifiedParameter());
picture. setTop(new DoubleFloat(100));
picture. setLeft(new DoubleFloat(50));Please let us know if you have any further questions.
Sincerely,
Friday, 22 December 2017, 05:33AM +02:00 from ajitk...@gmail.com:
Anna
--Have an excel worksheet with data. Adding an image following the example : http://jexcel-support.teamdev.com/samples/merge-and-insertadds it on top-left corner overlapping the data.Referring the example in http://jexcel-support.teamdev.com/samples/merge-and-insert
File file = new File("logo.jpg"); BStr bStr = new BStr(file.getAbsolutePath()); iPictures.insert(bStr,unspecifiedParameter);When adding an image to a worksheet, is there a way to specify X,Y coordinates and image width and image height?
You received this message because you are subscribed to the Google Groups "JExcel Forum" group.
To unsubscribe from this group and stop receiving emails from it, send an email to jexcel-forum+unsubscribe@teamdev.com.
application.getOleMessageLoop().doInvokeAndWait(new Runnable()
{
public void run()
{
_Worksheet worksheet = activeWorksheet.getPeer();
Shapes shapes = worksheet.getShapes();
shapes.addPicture(new BStr("c:\\Users\\Public\\Pictures\\Sample Pictures\\Chrysanthemum.jpg"),
new MsoTriState(MsoTriState.msoFalse),//link to file
new MsoTriState(MsoTriState.msoCTrue), //save with document
new SingleFloat(50), //left
new SingleFloat(50), //top
new SingleFloat(100), //width
new SingleFloat(100) //height
);
}
});