Difference between revisions of "TabulationParagraph class"
(Created page with "{{CGscriptClass_Template |Name=TabulationParagraph |Description=A paragraph possible to add to reports. Contains portions and paragraph specific styling |Constructors= {{CGscr...") |
|||
(4 intermediate revisions by one other user not shown) | |||
Line 1: | Line 1: | ||
{{CGscriptClass_Template | {{CGscriptClass_Template | ||
− | |Name=TabulationParagraph | + | |Name=<nowiki>TabulationParagraph</nowiki> |
− | |Description=A paragraph possible to add to reports. Contains portions and paragraph specific styling | + | |Description=<nowiki>A paragraph possible to add to reports. Contains portions and paragraph specific styling</nowiki> |
− | |Constructors= | + | |InheritsFrom=object|Constructors= |
{{CGscriptConstructors_Template|Parameters= | {{CGscriptConstructors_Template|Parameters= | ||
− | {{CGscriptParameters_Template|Type=TabulationParagraphStyle|Name=paragraphStyle|Description=Styling of the paragraph}} | + | {{CGscriptParameters_Template|Type=TabulationParagraphStyle|Name=<nowiki>paragraphStyle</nowiki>|Description=<nowiki>Styling of the paragraph</nowiki>}} |
− | |Description=Create a new empty Paragraph}} | + | |Description=<nowiki>Create a new empty Paragraph</nowiki>}} |
{{CGscriptConstructors_Template|Parameters= | {{CGscriptConstructors_Template|Parameters= | ||
− | {{CGscriptParameters_Template|Type=TabulationParagraphStyle|Name=paragraphStyle|Description=Styling of the paragraph|Comma=,}}{{CGscriptParameters_Template|Type=string|Name=text|Description=Text to be added as first portion|Comma=,}}{{CGscriptParameters_Template|Type=TabulationTextStyle|Name=textStyle|Description=The style to applied to the portion}} | + | {{CGscriptParameters_Template|Type=TabulationParagraphStyle|Name=<nowiki>paragraphStyle</nowiki>|Description=<nowiki>Styling of the paragraph</nowiki>|Comma=,}}{{CGscriptParameters_Template|Type=string|Name=<nowiki>text</nowiki>|Description=<nowiki>Text to be added as first portion</nowiki>|Comma=,}}{{CGscriptParameters_Template|Type=TabulationTextStyle|Name=<nowiki>textStyle</nowiki>|Description=<nowiki>The style to applied to the portion</nowiki>}} |
− | |Description=Create a new Paragraph with a portion}} | + | |Description=<nowiki>Create a new Paragraph with a portion</nowiki>}} |
|Methods= | |Methods= | ||
− | {{CGscriptMethods_Template|ReturnType=Empty|Name=AddLink|Parameters= | + | {{CGscriptMethods_Template|ReturnType=Empty|Name=<nowiki>AddLink</nowiki>|Parameters= |
− | {{CGscriptParameters_Template|Type=string|Name=text|Description=Text to be added to the paragraph|Comma=,}}{{CGscriptParameters_Template|Type=string|Name=link|Description=Link on the text|Comma=,}}{{CGscriptParameters_Template|Type=TabulationTextStyle|Name=textStyle|Description=The style to applied to the portion}} | + | {{CGscriptParameters_Template|Type=string|Name=<nowiki>text</nowiki>|Description=<nowiki>Text to be added to the paragraph</nowiki>|Comma=,}}{{CGscriptParameters_Template|Type=string|Name=<nowiki>link</nowiki>|Description=<nowiki>Link on the text</nowiki>|Comma=,}}{{CGscriptParameters_Template|Type=TabulationTextStyle|Name=<nowiki>textStyle</nowiki>|Description=<nowiki>The style to applied to the portion</nowiki>}} |
− | |Description=Add a new portion with link to the Paragraph}} | + | |Description=<nowiki>Add a new portion with link to the Paragraph</nowiki>}} |
− | {{CGscriptMethods_Template|ReturnType=Empty|Name=AddPortion|Parameters= | + | {{CGscriptMethods_Template|ReturnType=Empty|Name=<nowiki>AddPortion</nowiki>|Parameters= |
− | {{CGscriptParameters_Template|Type=string|Name=text|Description=Text to be added to the paragraph|Comma=,}}{{CGscriptParameters_Template|Type=TabulationTextStyle|Name=textStyle|Description=The style to applied to the portion}} | + | {{CGscriptParameters_Template|Type=string|Name=<nowiki>text</nowiki>|Description=<nowiki>Text to be added to the paragraph</nowiki>|Comma=,}}{{CGscriptParameters_Template|Type=TabulationTextStyle|Name=<nowiki>textStyle</nowiki>|Description=<nowiki>The style to applied to the portion</nowiki>}} |
− | |Description=Add a new portion to the Paragraph}} | + | |Description=<nowiki>Add a new portion to the Paragraph</nowiki>}} |
− | {{CGscriptMethods_Template|ReturnType=string|Name=ToString|Description=The string representation of the object.}} | + | {{CGscriptMethods_Template|ReturnType=string|Name=<nowiki>ToString</nowiki>|Inherited=object|Description=<nowiki>The string representation of the object.</nowiki>}} |
|Properties= | |Properties= | ||
− | {{CGscriptProperties_Template|ReturnType=string|Name=ObjectTypeName|HasGetter=1|Description=The name of the type of object.}} | + | {{CGscriptProperties_Template|ReturnType=string|Name=<nowiki>ObjectTypeName</nowiki>|HasGetter=1|Description=<nowiki>The name of the type of object.</nowiki>}} |
− | {{CGscriptProperties_Template|ReturnType=TypeInformation|Name=TypeInformation|HasGetter=1|Description=Get information about this class.}} | + | {{CGscriptProperties_Template|ReturnType=TypeInformation|Name=<nowiki>TypeInformation</nowiki>|HasGetter=1|Inherited=object|Description=<nowiki>Get information about this class.</nowiki>}} |
}} | }} | ||
+ | |||
+ | === <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); | ||
+ | |||
+ | //Add a new simple paragraph to the report in one line: | ||
+ | Tabulation_addParagraph(new TabulationParagraph(tps,"SubHeading",textStyle)); | ||
+ | </source> |
Latest revision as of 08:28, 2 July 2020
TabulationParagraph
A paragraph possible to add to reports. Contains portions and paragraph specific styling
Parent class
Inherits from object
Constructors
- (TabulationParagraphStyle paragraphStyle "Styling of the paragraph") - Create a new empty Paragraph
- (TabulationParagraphStyle paragraphStyle "Styling of the paragraph", string text "Text to be added as first portion", TabulationTextStyle textStyle "The style to applied to the portion") - Create a new Paragraph with a portion
Methods
- Empty AddLink(string text "Text to be added to the paragraph", string link "Link on the text", TabulationTextStyle textStyle "The style to applied to the portion") - Add a new portion with link to the Paragraph
- Empty AddPortion(string text "Text to be added to the paragraph", TabulationTextStyle textStyle "The style to applied to the portion") - Add a new portion to the Paragraph
- (From object) string ToString() - The string representation of the object.
Properties
- string ObjectTypeName { get; } - The name of the type of object.
- (From object) TypeInformation TypeInformation { get; } - Get information about this class.
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);
//Add a new simple paragraph to the report in one line:
Tabulation_addParagraph(new TabulationParagraph(tps,"SubHeading",textStyle));