I want to know how can I start some content from new page in report. For example, I have description of one model in DOC , after this model I have description of second model that should start not in the same page, but from new page and so on.
HI Vladimir,
Sure
var l_OutputObj = Context.createOutputObject(Constants.OUTWORD, "test.doc"); l_OutputObj.OutputTxt("Text on Page 1"); l_OutputObj.OutputField(Constants.FIELD_NEWPAGE, "Arial", 10, Constants.C_BLACK, Constants.C_BLACK, Constants.FMT_LEFT); l_OutputObj.OutputTxt("Text on Page 2"); l_OutputObj.WriteReport();
Regards,
Amol Patil
thanks
Can you also help me with table of contents ?
I use this code :
p_output.BeginSection(false, Constants.SECTION_INDEX) p_output.BeginParagraph( Constants.FMT_CENTER, 0, 0, 0, 0, 0) p_output.OutputLn("Table of Contents\n", "Sylfaen", 16, Constants.C_BLACK, Constants.C_TRANSPARENT, Constants.FMT_BOLD | Constants.FMT_CENTER, 0) p_output.EndParagraph() p_output.OutputField( Constants.FIELD_TOC, "ID_DEFAULT_FONT", 11, Constants.C_BLACK, Constants.C_TRANSPARENT, Constants.FMT_LEFT) p_output.EndSection()
It says :
No table of contents entries found.
How Can I insert tose entries. I want model names in this table and their pages. But don't know how to do this...
Hi! One way to add TOC entries in report is to define text style with format constants Constants.FMT_TOCENTRY(0-4) and use this style for headers. Example follows.
В общем, нужно определить стиль текста, который в описании формата включал бы константы уровней содержания. Вот пример:
oOut.DefineF("Заголовок 1", "Times New Roman", 14, Constants.C_BLACK, Constants.C_TRANSPARENT, Constants.FMT_CENTER | Constants.FMT_BOLD | Constants.FMT_TOCENTRY0, 0, 0, 0, 0, 0, 1); oOut.OutputLnF("Состав функциональных требований","Заголовок 1");
Hi Ilya , thanks for replay. I've defined text style the way you wrote but the result is the same : Table of Contents No table of contents entries found. Can you look through the code, where did I make mistake ? And is there another method to do this because Constants.FMT_TOCENTRY0 adds indexes to Headers, and we don't want them ! Большое спасибо
var output=Context.createOutputObject(); output.DefineF("header1", "Times New Roman", 14, Constants.C_BLACK, Constants.C_TRANSPARENT, Constants.FMT_CENTER | Constants.FMT_BOLD | Constants.FMT_TOCENTRY0, 0, 0, 0, 0, 0, 1); output.BeginSection(true, Constants.SECTION_INDEX) output.BeginParagraph( Constants.FMT_CENTER, 0, 0, 0, 0, 0) output.OutputLn("Table of Contents\n", "Times New Roman", 16, Constants.C_BLACK, Constants.C_TRANSPARENT, Constants.FMT_BOLD | Constants.FMT_CENTER, 0) output.EndParagraph() output.OutputField( Constants.FIELD_TOC, "ID_DEFAULT_FONT", 11, Constants.C_BLACK, Constants.C_TRANSPARENT, Constants.FMT_LEFT) output.EndSection() output.OutputLnF("Header value1","header1"); for (var i=0; i<12 ; i++ ){ output.OutputLn(" some text ","Times New Roman", 8,Constants.C_BLACK,Constants.C_TRANSPARENT,Constants.FMT_LEFT | Constants.FMT_BOLD,0); } output.OutputLnF("Header value2", "header1"); output.WriteReport()
Misha,
TOC is builded when the report is opening by doc's editor. You must using header style used by editor for building TOC exactly.
For MSWord it depends on localization of editor, by ex: "Заголовок 1", "Header 1", "Nagłówek 1". So the "Header 1", not "header1". Unfortunately ARIS API hasn't any function for change or test it. You can format TOC by using Output.SetTocFormat function. Regards Pawel TarachThanks Mr. Pawel Tarach ,
I almost did it , "Heading 1" worked. But when report opens in MSword, again it says
Table of Contents No table of contents entries found.
and when I make update to the table from Word - the table shows up. Should I specify something ?
As for me, I don't have to use only names of styles from my MS Word. In next example the TOC styles named 123 and 456 and it works properly.
var sFile = "123.doc"; var oOut = Context.createOutputObject(Constants.OUTWORD, sFile); oOut.Init(1049); oOut.DefineF("123", "Times New Roman", 14, Constants.C_BLACK, Constants.C_TRANSPARENT, Constants.FMT_CENTER | Constants.FMT_BOLD | Constants.FMT_TOCENTRY0, 0, 0, 0, 0, 0, 1); oOut.DefineF("456", "Times New Roman", 12, Constants.C_BLACK, Constants.C_TRANSPARENT, Constants.FMT_LEFT | Constants.FMT_TOCENTRY1, 0, 0, 0, 0, 0, 1); oOut.DefineF("Text", "Times New Roman", 12, Constants.C_BLACK, Constants.C_TRANSPARENT, Constants.FMT_LEFT , 0, 0, 0, 0, 0, 1); oOut.OutputField(Constants.FIELD_TOC, "Times New Roman", 14, Constants.C_BLACK, Constants.C_TRANSPARENT, Constants.FMT_LEFT); oOut.SetAutoTOCNumbering(false); oOut.OutputLnF("Text","Text"); oOut.OutputLnF("Text","Text"); oOut.OutputLnF("Text","Text"); oOut.OutputLnF("Состав функциональных требований","123"); oOut.OutputLnF("Text","Text"); oOut.OutputLnF("Состав функциональных требований2","456"); oOut.WriteReport(Context.getSelectedPath, sFile);
So as not to add indexes for headers you have to use function oOut.SetAutoTOCNumbering(false);
--
Ilya
Misha,
I took your example and ...
I use Polish releases of MSOffice, so I changed the your style "header1" with something what understands my editor.
var output=Context.createOutputObject(); output.DefineF("Nagłówek 1", "Times New Roman", 14, Constants.C_BLACK, Constants.C_TRANSPARENT, Constants.FMT_CENTER | Constants.FMT_BOLD | Constants.FMT_TOCENTRY0, 0, 0, 0, 0, 0, 1); output.BeginSection(true, Constants.SECTION_INDEX) output.BeginParagraph( Constants.FMT_CENTER, 0, 0, 0, 0, 0) output.OutputLn("Table of Contents\n", "Times New Roman", 16, Constants.C_BLACK, Constants.C_TRANSPARENT, Constants.FMT_BOLD | Constants.FMT_CENTER, 0) output.EndParagraph() output.OutputField( Constants.FIELD_TOC, "ID_DEFAULT_FONT", 11, Constants.C_BLACK, Constants.C_TRANSPARENT, Constants.FMT_LEFT) output.EndSection() output.OutputLnF("Header value1","Nagłówek 1"); for (var i=0; i<12 ; i++ ){ output.OutputLn(" some text ","Times New Roman", 8,Constants.C_BLACK,Constants.C_TRANSPARENT,Constants.FMT_LEFT | Constants.FMT_BOLD,0); } output.OutputLnF("Header value2", "Nagłówek 1"); output.WriteReport()
... and got the following results.
Regards
Pawel Tarach
"Nagłówek 1" with "Heading 1", it's in english version
),but no result ... Actually , when I open the Table of content MS WORD dialog box (in the picutre above) , the styles I use in code are there ("Heading 1" , even "123" , "345" as in Ilya's example) , but table of contents is empty. (No table of contents entries found.) Maybe there is something additional that I should have on ARIS Server ??? should I install ms word on it :D
What style requires the TOC of your editor?
Check the TOC in the generated report (No table of contents entries found.) and open it for editing. On the TOC window you get the necessary information about nedded style of 1st level header. Then use this style in your ARIS code to generate the header.