Hi,
I am trying to typecast the object to an excel format and add some hyperlinks. I am trying to get the output object after WriteReport(). Below are the code snippet.
var outObj= Context.createOutputObject();
//Creating a table in below method.
file.BeginTable(.......
file.DefineF("He.......
file.DefineF("He.......
file.DefineF("Co.......
file.DefineF("Re.......
file.TableRow();.......
//file.TableCell.......
file.TableCell(p.......
file.TableRow();
//file.TableCell.......
file.TableCell(".......
file.TableRow();
....
outObj.WriteReport();
//Then trying manipulate the data
var excelSheet = Context.getFile("sample.xls", Constants.LOCATION_OUTPUT);
Here I am getting null value for excelSheet .
Could you please guide me if I am missing anything.
Kay Fischbach on
You didn't really specify what you need the file for after you used the WriteReport method (manipulate?). If it's just about adding hyperlinks:
There is a far easier way to add hyperlinks. Any output you write (e.g. with OutputF) after creating a table cell will be written into that table cell until you either create a new row, add a new cell, or end the table.
So just use the TableCell (or TableCellF) method with an empty string as p_sText argument (the argument that specifies what ARIS should write into the cell after its creation), and directly after that use the OutputLink (or OutputLinkF) method to fill the table cell with content.
Example:
var o_Output = Context.createOutputObject(); o_Output.DefineF("Standard", "Arial", 11, Constants.C_BLACK, Constants.C_TRANSPARENT, Constants.FMT_LEFT, 0, 0, 0, 0, 0, 0); main(); o_Output.WriteReport(); function main(){ o_Output.BeginTable(100, Constants.C_BLACK, Constants.C_TRANSPARENT, Constants.FMT_LEFT, 0); o_Output.TableRow(); o_Output.TableCellF("", 50, "Standard"); o_Output.OutputLinkF("A link", "https://www.google.com", "Standard"); o_Output.TableCellF("", 50, "Standard"); o_Output.OutputLinkF("Another link", "https://www.softwareag.com", "Standard"); o_Output.TableRow(); o_Output.TableCellF("", 100, "Standard"); o_Output.OutputLinkF("A third link", "https://www.ariscommunity.com", "Standard"); o_Output.EndTable("Hello", 100, "Arial", 11, Constants.C_BLACK, Constants.C_TRANSPARENT, 0, Constants.FMT_LEFT, 0) }