I am working on a script that will create a standard header to models. I would also like to add an image to the models, but I am not finding a way to add an image to the model via script.
Hello Brandon,
in my tutorial - part 7 you should find everything you need to bring a picture to work in a page header. In terms of a model image the following code should work.
p_output.TableCell("", 33.26, getString("ID_DEFAULT_FONT"), 10, Constants.C_BLACK, RGB(255,255,255), 0, Constants.FMT_VTOP | Constants.FMT_LEFT, 0) p_output.BeginParagraph( Constants.FMT_LEFT, 0.71, 0.71, 0, 0, 0) writeData1(p_output, p_aModel1[i].Graphic(false, false, nLocale)) p_output.EndParagraph() function writeData1(p_output, p_IModelPicture) { p_output.OutGraphic(p_IModelPicture, -1, p_output.getCurrentMaxWidth(), p_output.GetPageHeight() - p_output.GetTopMargin() - p_output.GetBottomMargin() -20) } function RGB(r, g, b) { return (new java.awt.Color(r/255.0,g/255.0,b/255.0,1)).getRGB() & 0xFFFFFF }
Hope this helps!
Regards, Volker
Hello Volker,
I have figured out how to add an image to output. What I am looking for is adding an image, in this case company logo, to the models within ARIS. We want the logo to be visible on the model if someone decides to print the model.
Thanks in advance,
Brandon
Hello Shankar --
To add an image to an output file like a PDF, make sure you have the image imported into the group where your script resides or in the Common files group. The code listed below will create an output file with the logo.gif image displayed:
var output = Context.createOutputObject();
var image = Context.createPicture("logo.gif");
output.BeginSection(false,Constants.SECTION_DEFAULT);
output.OutGraphic(image,100,130,65);
output.EndSection();
output.WriteReport();
Thanks Brendon.. Would you know whether this works in Excel output as well? I know in another post, it was stated as not working in Excel.
UPDATED Few mins after posting the above statement:
Little bit of googling threw up this search result -- "Report zum Grafikexport nach Excel | ARIS User Forum " -- ofcourse that is a dated discussion & around ARIS Toolset 6.x... So not sure how much that'll work and what better ways do latest ARIS version have in adding graphics to Excel.
Any expert from IDS listening to this post to clarify on how the graphic could be added to Excel report output? Sebastian, could you help in having some expert review these 2 posts and respond.
Thanks & Regards,
Shankar
The first code I posted does not work in Excel. Below is new code that will output an image to an Excel file. To get this to work you need to add a Paragraph inside a TableCell:
var output = Context.createOutputObject();
var image = Context.createPicture("logo.gif");
output.BeginSection(false,Constants.SECTION_DEFAULT);
output.BeginTable(100,Constants.C_WHITE,Constants.C_WHITE,Constants.FMT_LEFT,0);
output.TableRow();
output.TableCell("",100,"Arial",10,Constants.C_BLACK,Constants.C_WHITE,0,Constants.FMT_LEFT,0);
output.BeginParagraph( Constants.FMT_LEFT, 0.71, 0.71, 0, 0, 0);
output.OutGraphic(image,100,130,65);
output.EndParagraph();
output.EndSection();
output.WriteReport();