AT
Hello, how do i create a script with ToC (Table of Content) ? I have tried
output.BeginSection(false, Constants.SECTION_INDEX); output.SetAutoTOCNumbering(true); output.OutputField(Constants.FIELD_TOC, "Arial", 10, Constants.C_BLACK, Constants.C_WHITE, Constants.FMT_LEFT); output.EndSection();
but it doesn't output anything. Of course, i need some kind of "tokens" based on which ToC would be generated, but what this "tokens" are? How they look like? And am generating ToC properly?
Hi, this is how I do that in my report:
output.BeginSection(false, Constants.SECTION_INDEX); //Sets the autonumbering on output.SetAutoTOCNumbering(false); //Defines the style for the four levels in the TOC output.SetTOCFormat(0, getString("ID_DEFAULT_FONT"), 12, Constants.C_BLACK, Constants.C_WHITE, Constants.FMT_LEFT | Constants.FMT_ITALIC, 0, 0, 0, 0); output.SetTOCFormat(1, getString("ID_DEFAULT_FONT"), 11, Constants.C_BLACK, Constants.C_WHITE, Constants.FMT_LEFT | Constants.FMT_ITALIC, 5, 5, 0, 0); output.SetTOCFormat(2, getString("ID_DEFAULT_FONT"), 10, Constants.C_BLACK, Constants.C_WHITE, Constants.FMT_LEFT | Constants.FMT_ITALIC, 10 , 5, 2, 2); output.SetTOCFormat(3, getString("ID_DEFAULT_FONT"), 9, Constants.C_BLACK, Constants.C_WHITE, Constants.FMT_LEFT, 15, 5, 2, 2); //Output text output.OutputLn("Tabla de Contenidos", getString("ID_DEFAULT_FONT"), 16, Constants.C_BLACK, Constants.C_WHITE, Constants.FMT_LEFT | Constants.FMT_BOLD, 0); //Adds the table of content output.OutputField(Constants.FIELD_TOC, getString("ID_DEFAULT_FONT"), 10, Constants.C_BLACK, Constants.C_WHITE, Constants.FMT_LEFT); output.EndSection();
And then you must left a token like this:
output.addLocalBookmark("TOC"); output.BeginParagraphF(getString("ID_STYLE_TOC_HEADING_1")); output.OutputLnF("Control de cambios", getString("ID_STYLE_DEFAULT_BOLD")); output.EndParagraph();
I hope this help you.