Difference between revisions of "Tabulation addParagraph"
(Created page with "{{Function_Template|Name=Tabulation_addParagraph|ReturnType=Empty |Parameters= |Name=Paragraph|ConstantType=Object }}") |
|||
(6 intermediate revisions by the same user not shown) | |||
Line 3: | Line 3: | ||
|Name=Paragraph|ConstantType=Object | |Name=Paragraph|ConstantType=Object | ||
}} | }} | ||
+ | |||
+ | ==== Tabulation_addParagraph ==== | ||
+ | |||
+ | Adds an paragraph to the report | ||
+ | |||
+ | '''Syntax''' | ||
+ | |||
+ | Tabulation_addParagraph(''TabulationParagraph'') | ||
+ | |||
+ | '''Arguments''' | ||
+ | |||
+ | *[[TabulationParagraph class|''TabulationParagraph'']] | ||
+ | |||
+ | === <span style="color:#DF8621">'''Examples'''</span> === | ||
+ | |||
+ | <source lang="javascript"> | ||
+ | //Styling of paragraph | ||
+ | TabulationParagraphStyle paragraphStyle = new TabulationParagraphStyle(); | ||
+ | paragraphStyle.Alignment = "center"; //left, right, center. | ||
+ | paragraphStyle.MarginTopPoints = 10; //1-399 | ||
+ | paragraphStyle.MarginLeftPoints = 10;//1-399 | ||
+ | |||
+ | //Styling of portions | ||
+ | TabulationTextStyle textStyle = new TabulationTextStyle(); | ||
+ | textStyle.Color = Color_getByName("red"); //Takes a color array- | ||
+ | textStyle.Color = Color_getByRGB(0,0,0); // can also be set from rgb. | ||
+ | textStyle.FontFace = "Bariol Regular"; | ||
+ | textStyle.FontSize = 40; //1-399 | ||
+ | textStyle.Bold = false; | ||
+ | textStyle.Italic = false; | ||
+ | textStyle.Underline = false; | ||
+ | |||
+ | //Use Tabulation_getAvailableFonts(); to find available fonts | ||
+ | Tabulation_getAvailableFonts(); | ||
+ | |||
+ | //Create the paragraph | ||
+ | TabulationParagraph paragraph = new TabulationParagraph(paragraphStyle); //It needs the paragraphStyle defined above. | ||
+ | //The paragraph contains portions of text | ||
+ | //Each portion can be styled individually with a TabulationTextStyle | ||
+ | paragraph.AddPortion("Some text", textStyle); | ||
+ | |||
+ | //A paragraph can also be instatiated with portion and portion style in constructor | ||
+ | TabulationParagraph paragraph2 = new TabulationParagraph(paragraphStyle, "Some text ", textStyle); | ||
+ | |||
+ | //It is also possible to add hyperlinks | ||
+ | paragraph2.AddLink("CatGlobe", "http://catglobe.com", textStyle); | ||
+ | |||
+ | //Add the paragraphs to the report | ||
+ | Tabulation_addParagraph(paragraph); | ||
+ | Tabulation_addParagraph(paragraph2); | ||
+ | </source> | ||
+ | [[category:Diagram/report generating CGScript functions]] | ||
+ | |||
+ | |||
+ | {{note}} ''This function should be paired with function [http://wiki.catglobe.com/index.php/Tabulation_setShowResultAsPdf Tabulation_setShowResultAsPdf].'' | ||
+ | |||
+ | '''Availability''' | ||
+ | |||
+ | Version 6.0 |
Latest revision as of 09:44, 24 June 2016
Paragraph
Please write a description and submit to code to autogen it next time
Syntax
Paragraph();
Return type
Empty
Tabulation_addParagraph
Adds an paragraph to the report
Syntax
Tabulation_addParagraph(TabulationParagraph)
Arguments
Examples
//Styling of paragraph
TabulationParagraphStyle paragraphStyle = new TabulationParagraphStyle();
paragraphStyle.Alignment = "center"; //left, right, center.
paragraphStyle.MarginTopPoints = 10; //1-399
paragraphStyle.MarginLeftPoints = 10;//1-399
//Styling of portions
TabulationTextStyle textStyle = new TabulationTextStyle();
textStyle.Color = Color_getByName("red"); //Takes a color array-
textStyle.Color = Color_getByRGB(0,0,0); // can also be set from rgb.
textStyle.FontFace = "Bariol Regular";
textStyle.FontSize = 40; //1-399
textStyle.Bold = false;
textStyle.Italic = false;
textStyle.Underline = false;
//Use Tabulation_getAvailableFonts(); to find available fonts
Tabulation_getAvailableFonts();
//Create the paragraph
TabulationParagraph paragraph = new TabulationParagraph(paragraphStyle); //It needs the paragraphStyle defined above.
//The paragraph contains portions of text
//Each portion can be styled individually with a TabulationTextStyle
paragraph.AddPortion("Some text", textStyle);
//A paragraph can also be instatiated with portion and portion style in constructor
TabulationParagraph paragraph2 = new TabulationParagraph(paragraphStyle, "Some text ", textStyle);
//It is also possible to add hyperlinks
paragraph2.AddLink("CatGlobe", "http://catglobe.com", textStyle);
//Add the paragraphs to the report
Tabulation_addParagraph(paragraph);
Tabulation_addParagraph(paragraph2);
Note: This function should be paired with function Tabulation_setShowResultAsPdf.
Availability
Version 6.0