Hallo, i am scripting an Word-Report for my ARIS Models (ARIS Business Architect 7.1). I have problem with align table of contents to right (Arabic Language).
24 Replies
-
-
Hi,
you just have to set the constant that defines the alignment of the table cell to the value "right". For example:
oOutputFile.TableCell("test", 20, "Arial", 10, Constants.C_BLACK, Constants.C_BLUE, 0, Constants.FMT_BOLD | Constants.FMT_RIGHT | Constants.FMT_VTOP, 0);
I hope that this will help you.
Regards
Eva -
-
Can you please paste the source code into the comment so that I can test it.
-
var g_nLoc = Context.getSelectedLanguage(); var bOutputSAP = false; var bOutputNonSAP = true; var bOutputDescription = false; if(g_nLoc==1025){ var oDirection=Constants.FMT_RIGHT; var g_sLine = getString("ID_REPORTDEF_26_AR"); var g_sHeader_add = getString("ID_REPORTDEF_31_AR"); } else { var oDirection=Constants.FMT_LEFT; var g_sLine = getString("ID_REPORTDEF_26"); var g_sHeader_add = getString("ID_REPORTDEF_31"); } function docMain(){ if(bInitOk){ var oOutput = Context.createOutputObject() //var xlTableActive=false oOutput.DefineF(getString("ID_STYLE_RD_INFO"), getString("ID_DEFAULT_FONT"), 14, RGB(0,0,0), Constants.C_TRANSPARENT, Constants.FMT_BOLD | Constants.FMT_CENTER| Constants.FMT_VTOP, 0, 0, 1.76, 8.82, 0, 1) oOutput.DefineF(getString("ID_STYLE_RD_TITLE"), getString("ID_DEFAULT_FONT"), 21, RGB(0,0,0), Constants.C_TRANSPARENT, Constants.FMT_BOLD | Constants.FMT_CENTER| Constants.FMT_VTOP, 0, 0, 1.76, 8.82, 0, 1) oOutput.DefineF(getString("ID_STYLE_RD_DEFAULT"), getString("ID_DEFAULT_FONT"), 11, RGB(0,0,0), Constants.C_TRANSPARENT, oDirection | Constants.FMT_VTOP, 0, 0, 0, 0, 0, 1) oOutput.DefineF(getString("ID_STYLE_RD_HEADING_4"), getString("ID_DEFAULT_FONT"), 12, RGB(0,0,0), Constants.C_TRANSPARENT, Constants.FMT_ITALIC | Constants.FMT_BOLD | oDirection | Constants.FMT_VTOP| Constants.FMT_TOCENTRY3 , 0, 0, 0, 0, 0, 1) oOutput.DefineF(getString("ID_STYLE_RD_TABLE_CONTENT"), getString("ID_DEFAULT_FONT"), 8, RGB(0,0,0), Constants.C_TRANSPARENT, oDirection| Constants.FMT_VTOP, 0, 0, 0, 0, 0, 1) oOutput.DefineF(getString("ID_STYLE_RD_HEADING_3"), getString("ID_DEFAULT_FONT"), 12, RGB(0,0,0), Constants.C_TRANSPARENT, Constants.FMT_ITALIC | Constants.FMT_BOLD | oDirection | Constants.FMT_VTOP| Constants.FMT_TOCENTRY2 , 0, 0, 1, 1, 0, 1) oOutput.DefineF(getString("ID_STYLE_RD_HEADER_FOOTER"), getString("ID_DEFAULT_FONT"), 10, RGB(0,0,0), Constants.C_TRANSPARENT, oDirection| Constants.FMT_VTOP, 0, 0, 0, 0, 0, 1) oOutput.DefineF(getString("ID_STYLE_RD_HEADING_2"), getString("ID_DEFAULT_FONT"), 14, RGB(0,0,0), Constants.C_TRANSPARENT, Constants.FMT_ITALIC | Constants.FMT_BOLD | oDirection | Constants.FMT_VTOP| Constants.FMT_TOCENTRY1 , 0, 0, 2, 2, 0, 1) oOutput.DefineF(getString("ID_STYLE_RD_HEADING_1"), getString("ID_DEFAULT_FONT"), 18, RGB(0,0,0), Constants.C_TRANSPARENT, Constants.FMT_BOLD | oDirection| Constants.FMT_VTOP| Constants.FMT_TOCENTRY0 , 0, 0, 4, 4, 0, 1) oOutput.DefineF(getString("ID_STYLE_RD_TABLE_HEAD"), getString("ID_DEFAULT_FONT"), 8, RGB(0,0,0), Constants.C_TRANSPARENT, Constants.FMT_BOLD | Constants.FMT_CENTER| Constants.FMT_VTOP, 0, 0, 0, 0, 0, 1) oOutput.DefineF(getString("ID_STYLE_RD_HEADING_5"), getString("ID_DEFAULT_FONT"), 11, RGB(0,0,0), Constants.C_TRANSPARENT, Constants.FMT_ITALIC | Constants.FMT_BOLD | oDirection | Constants.FMT_VTOP| Constants.FMT_TOCENTRY3 , 0, 0, 0, 0, 0, 1) oOutput.DefineF(getString("ID_STYLE_DCS_DEFAULT"), getString("ID_DEFAULT_FONT"), 11, RGB(0,0,0), Constants.C_TRANSPARENT, oDirection | Constants.FMT_VTOP, 0, 0, 0, 0, 0, 1) setupOutputObject( oOutput, g_oSelectedObjDef); oOutput.SetTitle(Context.getScriptInfo(Constants.SCRIPT_NAME)) } if(bInitOk){ // IF EVERYTHING WAS OK, THE DOCUMENT CAN BE CREATED // THIS IS THE MAIN STRUCTURE OF THE DOCUMENT //Cover page writeFirstPage( oOutput, g_oSelectedObjOcc ); //Document Approvals writeDocumentApprovalsPage( oOutput, g_oSelectedObjDef ); //Document Control Sheet writeDocumentControlSheet( oOutput, g_oSelectedObjDef ); //Table of contents createTableOfContents(oOutput); // 1. Introduction createIntroduction(oOutput); // Dynamic Content (Processes / model graphics etc) createContent(oOutput, g_oSelectedObjOcc); // ANNEX 1: Process Leveling Conventions writeAnnex01(oOutput); // ANNEX 1_2: Symbol conventions writeAnnex0102(oOutput); // ANNEX 1_3: How to access the portal writeAnnex0103(oOutput); // ANNEX 2: Remarks Page writeAnnex02(oOutput); // ANNEX 3: Workshop participants (show only if Non-SAP involved) if(bOutputNonSAP){ writeAnnex03(oOutput); } // ANNEX 4: List of assigned collateral documents writeListOfCollateralDocuments(oOutput, g_aDocuments); oOutput.WriteReport() } } function createTableOfContents(p_output) { //produce one table sheet per section if(xlTableActive && Context.getSelectedFormat()==Constants.OUTEXCEL) { p_output.EndTable("", 100, "", 10, Constants.C_BLACK, Constants.C_TRANSPARENT, 0, oDirection, 0) xlTableActive=false } //p_output.BeginSection(false, Constants.SECTION_INDEX) p_output.BeginSection(nDocPageHeight, nDocPageWidth, nDocDistHeader, nDocDistFooter, nDocLeftMargin, nDocRightMargin, nDocTopMargin, nDocBottomMargin, true, Constants.SECTION_INDEX) //setupOutputObject( p_output ) //use defaults if(Context.getSelectedFormat()==Constants.OUTEXCEL) { p_output.BeginTable(100, Constants.C_BLACK, Constants.C_TRANSPARENT, oDirection | Constants.FMT_REPEAT_HEADER, 0) xlTableActive=true } p_output.BeginParagraphF(getString("ID_STYLE_RD_DEFAULT")) //to format the TOC output use output.SetTOCFormat(iLevel, sFont, iFontSize, nFontColor, nBackgroundColor, nFormat, nLeftIndentation, nRightIndentation, nDistTop, nDistBottom) // p_output.OutputLn( Constants.FIELD_TOC, getString("ID_FONT_BOOK_ANTIQUA"), 12, RGB(0,0,0), Constants.C_TRANSPARENT, Constants.FMT_BOLD | Constants.FMT_RIGHT| Constants.FMT_TOCENTRY0 , 0) p_output.OutputField( Constants.FIELD_TOC, getString("ID_FONT_BOOK_ANTIQUA"), 11, Constants.C_DARK_RED, Constants.C_TRANSPARENT,oDirection) // p_output.SetTOCFormat(Constants.FIELD_TOC, "Times New Roman (Headings CS)", 11, Constants.C_DARK_RED, Constants.C_GRAY, oDirection, nDocLeftMargin, nDocRightMargin, nDocTopMargin, nDocBottomMargin) p_output.EndParagraph() if(Context.getSelectedFormat()==Constants.OUTEXCEL) { p_output.EndTable(getString("ID_REPORTDEF_TOC_25"), 100, "", 10, Constants.C_BLACK, Constants.C_TRANSPARENT, 0, oDirection, 0) xlTableActive=false } p_output.EndSection() }
Thank you for your interest
-
Hi,
as I understand you want to format the table-of-content the way it has to be for arabic language?
I think this is not possible at the moment but can be realized in a service release. Could you please confirm, if the following format whould be correct (or correct me if it is not)?
{page number}.............{chapter caption} {chapter number}
(and right aligned)BR,
Torsten -
The report appears in this format
then I select the table and click on the key (ctrl+shift) so that it appears as follows.
-
Hi Mr. Fadi Sahioun,
is the second example the format that you want it to be?
Or what needs to be changed?
Thanks,
Torsten -
-
-
-
-
-
Hi Mr. Grauer,
yes, it is already released. Please make sure that your report uses the extended output object, either by calling
Context.setProperty("use-new-output",true)
before creating the output object or by setting the extended output object as the default in the server configuration file (search for "use-new-output" in the defaultserversettings.cfg).BR, Torsten
-
-
Please have a look at your styles and TOC styles in the script. Maybe you use a style name twice?
Or do you maybe use 7.2 SR01? In this version this message appeared repeatedly. -
oh yes thank you... but how do i change the table of contents direction as in Arabic format:
{page number}.............{chapter caption} {chapter number}
(right aligned)
using the command that you mentioned:
Context.setProperty("use-new-output",true)?
-
This should be done automatically, if the attribute language (which is the language used for the output document) is a right-to-left language.
-
The attribute language is a right-to-left language but still the TOC comes out as for a left-to-right lang.
Is there any way to force the change of direction ?
Thank you
-
Could you attach a small script + instructions to reproduce this behaviour?
Thank you.
-
Please download the link below:
/system/files/editor/files/TOC Test.zip
Change its extension to .arx
and run it from any object
Thank you
-
Hm. It once worked... Needs to be fixed again for the next service release.
-
Hi,
After I added to my report the Context.setProperty("use-new-output",true) command my table of context disappeared and my internal hyperlink connection got scrambled,
Can anyone please help me?The code for the TOC goes like this
g_ooutfile.SetTOCFormat(0, "Arial", 11, Constants.C_BLACK, Constants.C_TRANSPARENT,Constants.FMT_BOLD| Constants.FMT_LEFT, 0, 0, 0, 0); g_ooutfile.SetTOCFormat(1, "Arial", 11, Constants.C_BLACK, Constants.C_TRANSPARENT, Constants.FMT_BOLD| Constants.FMT_LEFT ,1, 1, 0, 0); g_ooutfile.SetTOCFormat(2, "Arial", 10, Constants.C_BLACK, Constants.C_TRANSPARENT, Constants.FMT_LEFT ,2, 2, 0, 0); g_ooutfile.SetTOCFormat(3, "Arial", 9, Constants.C_BLACK, Constants.C_TRANSPARENT,Constants.FMT_BOLD| Constants.FMT_LEFT ,3,10, 0, 0); var firstLevel = "HEADING 1" var secondLevel = "HEADING 2" var thirdLevel = "HEADING 3" var fourthLevel = "HEADING 4" g_ooutfile.DefineF(firstLevel, "Arial", 12, Constants.C_BLACK, Constants.C_TRANSPARENT, Constants.FMT_BOLD|Constants.FMT_LEFT| Constants.FMT_VTOP | Constants.FMT_TOCENTRY0, 0, 0, 0, 0, 0, 1); g_ooutfile.DefineF(secondLevel, "Arial", 11, Constants.C_BLACK, Constants.C_TRANSPARENT, Constants.FMT_BOLD| Constants.FMT_LEFT| Constants.FMT_VTOP | Constants.FMT_TOCENTRY1 , 4, 0, 0, 0, 0, 1); g_ooutfile.DefineF(thirdLevel, "Arial", 11, Constants.C_BLACK, Constants.C_TRANSPARENT, Constants.FMT_LEFT| Constants.FMT_VTOP | Constants.FMT_TOCENTRY2 , 8, 0, 0, 0, 0, 1); g_ooutfile.DefineF(fourthLevel, "Arial", 11, Constants.C_BLACK, Constants.C_TRANSPARENT, Constants.FMT_BOLD| Constants.FMT_LEFT| Constants.FMT_VTOP | Constants.FMT_TOCENTRY3, 12, 0, 0, 0, 0, 1); function outputTOC( ){ g_ooutfile.BeginSection(true, Constants.SECTION_INDEX); g_ooutfile.OutputLnF("Table Of Contents", "Ariel18BoldCenter" ); g_ooutfile.OutputLnF("","Ariel18BoldCenter" ); g_ooutfile.SetAutoTOCNumbering(true) g_ooutfile.BeginParagraph(Constants.FMT_LEFT, 5, 5, 5, 5, 0, 2, 10); g_ooutfile.OutputField( Constants.FIELD_TOC, "Arial", 10,Constants.C_BLACK, Constants.C_TRANSPARENT, Constants.FMT_LEFT); g_ooutfile.EndParagraph(); //g_ooutfile.EndParagraph(); g_ooutfile.EndSection(); }//END::outputTOC() g_ooutfile.OutputLnF("Executive Summary", firstLevel);
and the code for the hiper link goes like this
g_ooutfile.DefineF("insteadOfHeading", "Arial", 11, Constants.C_BLACK, Constants.C_TRANSPARENT, Constants.FMT_BOLD| Constants.FMT_LEFT| Constants.FMT_VTOP | Constants.FMT_LINKTARGET | Constants.FMT_TOCENTRY1, 4, 0, 0, 0, 0, 1); g_ooutfile.DefineF("insteadOfHeading2", "Arial", 10, Constants.C_BLACK, Constants.C_TRANSPARENT, Constants.FMT_BOLD| Constants.FMT_LEFT| Constants.FMT_VTOP | Constants.FMT_LINKTARGET | Constants.FMT_TOCENTRY2, 8, 0, 0, 0, 0, 1); g_ooutfile.OutputLinkF(ScreenViewAppName,ScreenViewAppName,"Ariel10LeftLink"); g_ooutfile.OutputLnF(ScreenViewAppName, "insteadOfHeading");
Thank you very much in advance,
Gilad -
Hi,
After I added to my report the Context.setProperty("use-new-output",true) command my table of context disappeared and my internal hyperlink connection got scrambled,
Can anyone please help me?The code for the TOC goes like this
g_ooutfile.SetTOCFormat(0, "Arial", 11, Constants.C_BLACK, Constants.C_TRANSPARENT,Constants.FMT_BOLD| Constants.FMT_LEFT, 0, 0, 0, 0); g_ooutfile.SetTOCFormat(1, "Arial", 11, Constants.C_BLACK, Constants.C_TRANSPARENT, Constants.FMT_BOLD| Constants.FMT_LEFT ,1, 1, 0, 0); g_ooutfile.SetTOCFormat(2, "Arial", 10, Constants.C_BLACK, Constants.C_TRANSPARENT, Constants.FMT_LEFT ,2, 2, 0, 0); g_ooutfile.SetTOCFormat(3, "Arial", 9, Constants.C_BLACK, Constants.C_TRANSPARENT,Constants.FMT_BOLD| Constants.FMT_LEFT ,3,10, 0, 0); var firstLevel = "HEADING 1" var secondLevel = "HEADING 2" var thirdLevel = "HEADING 3" var fourthLevel = "HEADING 4" g_ooutfile.DefineF(firstLevel, "Arial", 12, Constants.C_BLACK, Constants.C_TRANSPARENT, Constants.FMT_BOLD|Constants.FMT_LEFT| Constants.FMT_VTOP | Constants.FMT_TOCENTRY0, 0, 0, 0, 0, 0, 1); g_ooutfile.DefineF(secondLevel, "Arial", 11, Constants.C_BLACK, Constants.C_TRANSPARENT, Constants.FMT_BOLD| Constants.FMT_LEFT| Constants.FMT_VTOP | Constants.FMT_TOCENTRY1 , 4, 0, 0, 0, 0, 1); g_ooutfile.DefineF(thirdLevel, "Arial", 11, Constants.C_BLACK, Constants.C_TRANSPARENT, Constants.FMT_LEFT| Constants.FMT_VTOP | Constants.FMT_TOCENTRY2 , 8, 0, 0, 0, 0, 1); g_ooutfile.DefineF(fourthLevel, "Arial", 11, Constants.C_BLACK, Constants.C_TRANSPARENT, Constants.FMT_BOLD| Constants.FMT_LEFT| Constants.FMT_VTOP | Constants.FMT_TOCENTRY3, 12, 0, 0, 0, 0, 1); function outputTOC( ){ g_ooutfile.BeginSection(true, Constants.SECTION_INDEX); g_ooutfile.OutputLnF("Table Of Contents", "Ariel18BoldCenter" ); g_ooutfile.OutputLnF("","Ariel18BoldCenter" ); g_ooutfile.SetAutoTOCNumbering(true) g_ooutfile.BeginParagraph(Constants.FMT_LEFT, 5, 5, 5, 5, 0, 2, 10); g_ooutfile.OutputField( Constants.FIELD_TOC, "Arial", 10,Constants.C_BLACK, Constants.C_TRANSPARENT, Constants.FMT_LEFT); g_ooutfile.EndParagraph(); //g_ooutfile.EndParagraph(); g_ooutfile.EndSection(); }//END::outputTOC() g_ooutfile.OutputLnF("Executive Summary", firstLevel);
and the code for the Hyperlink goes like this
g_ooutfile.DefineF("insteadOfHeading", "Arial", 11, Constants.C_BLACK, Constants.C_TRANSPARENT, Constants.FMT_BOLD| Constants.FMT_LEFT| Constants.FMT_VTOP | Constants.FMT_LINKTARGET | Constants.FMT_TOCENTRY1, 4, 0, 0, 0, 0, 1); g_ooutfile.DefineF("insteadOfHeading2", "Arial", 10, Constants.C_BLACK, Constants.C_TRANSPARENT, Constants.FMT_BOLD| Constants.FMT_LEFT| Constants.FMT_VTOP | Constants.FMT_LINKTARGET | Constants.FMT_TOCENTRY2, 8, 0, 0, 0, 0, 1); g_ooutfile.OutputLinkF(ScreenViewAppName,ScreenViewAppName,"Ariel10LeftLink"); g_ooutfile.OutputLnF(ScreenViewAppName, "insteadOfHeading");
Thank you very much in advance,
Gilad