Difference between revisions of "PptFile class"
(12 intermediate revisions by the same user not shown) | |||
Line 146: | Line 146: | ||
{{CGscriptParameters_Template|Type=int|Name=<nowiki>idx</nowiki>|Description=<nowiki>Index of slide.</nowiki>|Comma=,}}{{CGscriptParameters_Template|Type=string|Name=<nowiki>name</nowiki>|Description=<nowiki>Name of diagram.</nowiki>|Comma=,}}{{CGscriptParameters_Template|Type=number|Name=<nowiki>maxValue</nowiki>|Description=<nowiki>Maximum value.</nowiki>|Comma=,}}{{CGscriptParameters_Template|Type=number|Name=<nowiki>minValue</nowiki>|Description=<nowiki>Minimum value.</nowiki>}} | {{CGscriptParameters_Template|Type=int|Name=<nowiki>idx</nowiki>|Description=<nowiki>Index of slide.</nowiki>|Comma=,}}{{CGscriptParameters_Template|Type=string|Name=<nowiki>name</nowiki>|Description=<nowiki>Name of diagram.</nowiki>|Comma=,}}{{CGscriptParameters_Template|Type=number|Name=<nowiki>maxValue</nowiki>|Description=<nowiki>Maximum value.</nowiki>|Comma=,}}{{CGscriptParameters_Template|Type=number|Name=<nowiki>minValue</nowiki>|Description=<nowiki>Minimum value.</nowiki>}} | ||
|Description=<nowiki>Set the minimum and maximum values of the horizontal axis of the diagram with the given name on the given slide to the values given.</nowiki>}} | |Description=<nowiki>Set the minimum and maximum values of the horizontal axis of the diagram with the given name on the given slide to the values given.</nowiki>}} | ||
+ | {{CGscriptMethods_Template|ReturnType=Empty|Name=<nowiki>SetMapChartData</nowiki>|Parameters= | ||
+ | {{CGscriptParameters_Template|Type=int|Name=<nowiki>idx</nowiki>|Description=<nowiki>Index of slide.</nowiki>|Comma=,}}{{CGscriptParameters_Template|Type=string|Name=<nowiki>name</nowiki>|Description=<nowiki>Name of diagram.</nowiki>|Comma=,}}{{CGscriptParameters_Template|Type=array|Name=<nowiki>geodata</nowiki>|Description=<nowiki>Geo data for the table that helps Excel figure out what part of the map to highlight. E.g. {{'Province', 'County'}, {'Northern Ireland', 'Antrim'}, ...} or {{'Kommune'}, {'Glostrup'}, ...}</nowiki>|Comma=,}}{{CGscriptParameters_Template|Type=array|Name=<nowiki>data</nowiki>|Description=<nowiki>Data for the series. E.g. {{'Series1'}, {10}, {4}, {7}}</nowiki>|Comma=,}}{{CGscriptParameters_Template|Type=string|Name=<nowiki>chartTitle</nowiki>|Description=<nowiki>Title of the chart.</nowiki>}} | ||
+ | |Description=<nowiki>Set the values of the diagram with the given name on the given slide to the values given.</nowiki>}} | ||
{{CGscriptMethods_Template|ReturnType=Empty|Name=<nowiki>SetMasterAndLayout</nowiki>|Parameters= | {{CGscriptMethods_Template|ReturnType=Empty|Name=<nowiki>SetMasterAndLayout</nowiki>|Parameters= | ||
{{CGscriptParameters_Template|Type=int|Name=<nowiki>idx</nowiki>|Description=<nowiki>Index of slide.</nowiki>|Comma=,}}{{CGscriptParameters_Template|Type=string|Name=<nowiki>mastername</nowiki>|Description=<nowiki>Name of the masterslide.</nowiki>|Comma=,}}{{CGscriptParameters_Template|Type=string|Name=<nowiki>layoutNameOrType</nowiki>|Description=<nowiki>Layout from the master slide.</nowiki>}} | {{CGscriptParameters_Template|Type=int|Name=<nowiki>idx</nowiki>|Description=<nowiki>Index of slide.</nowiki>|Comma=,}}{{CGscriptParameters_Template|Type=string|Name=<nowiki>mastername</nowiki>|Description=<nowiki>Name of the masterslide.</nowiki>|Comma=,}}{{CGscriptParameters_Template|Type=string|Name=<nowiki>layoutNameOrType</nowiki>|Description=<nowiki>Layout from the master slide.</nowiki>}} | ||
Line 171: | Line 174: | ||
{{CGscriptMethods_Template|ReturnType=Empty|Name=<nowiki>SetTableBackgroundColorByHexString</nowiki>|Parameters= | {{CGscriptMethods_Template|ReturnType=Empty|Name=<nowiki>SetTableBackgroundColorByHexString</nowiki>|Parameters= | ||
{{CGscriptParameters_Template|Type=int|Name=<nowiki>idx</nowiki>|Description=<nowiki>Index of slide.</nowiki>|Comma=,}}{{CGscriptParameters_Template|Type=string|Name=<nowiki>name</nowiki>|Description=<nowiki>Name of table.</nowiki>|Comma=,}}{{CGscriptParameters_Template|Type=array|Name=<nowiki>coloredCells</nowiki>|Description=<nowiki>See SetTableBackgroundColor</nowiki>}} | {{CGscriptParameters_Template|Type=int|Name=<nowiki>idx</nowiki>|Description=<nowiki>Index of slide.</nowiki>|Comma=,}}{{CGscriptParameters_Template|Type=string|Name=<nowiki>name</nowiki>|Description=<nowiki>Name of table.</nowiki>|Comma=,}}{{CGscriptParameters_Template|Type=array|Name=<nowiki>coloredCells</nowiki>|Description=<nowiki>See SetTableBackgroundColor</nowiki>}} | ||
− | |Description=<nowiki>Obsolete | + | |Obsolete=1 |
+ | |Description=<nowiki>[Obsolete] Same as SetTableBackgroundColor.</nowiki>}} | ||
{{CGscriptMethods_Template|ReturnType=Empty|Name=<nowiki>SetTableBackgroundColorByRGB</nowiki>|Parameters= | {{CGscriptMethods_Template|ReturnType=Empty|Name=<nowiki>SetTableBackgroundColorByRGB</nowiki>|Parameters= | ||
{{CGscriptParameters_Template|Type=int|Name=<nowiki>idx</nowiki>|Description=<nowiki>Index of slide.</nowiki>|Comma=,}}{{CGscriptParameters_Template|Type=string|Name=<nowiki>name</nowiki>|Description=<nowiki>Name of table.</nowiki>|Comma=,}}{{CGscriptParameters_Template|Type=array|Name=<nowiki>coloredCells</nowiki>|Description=<nowiki>See SetTableBackgroundColor</nowiki>}} | {{CGscriptParameters_Template|Type=int|Name=<nowiki>idx</nowiki>|Description=<nowiki>Index of slide.</nowiki>|Comma=,}}{{CGscriptParameters_Template|Type=string|Name=<nowiki>name</nowiki>|Description=<nowiki>Name of table.</nowiki>|Comma=,}}{{CGscriptParameters_Template|Type=array|Name=<nowiki>coloredCells</nowiki>|Description=<nowiki>See SetTableBackgroundColor</nowiki>}} | ||
− | |Description=<nowiki>Obsolete | + | |Obsolete=1 |
+ | |Description=<nowiki>[Obsolete] Same as SetTableBackgroundColor.</nowiki>}} | ||
{{CGscriptMethods_Template|ReturnType=Empty|Name=<nowiki>SetTableBackgroundColorPartially</nowiki>|Parameters= | {{CGscriptMethods_Template|ReturnType=Empty|Name=<nowiki>SetTableBackgroundColorPartially</nowiki>|Parameters= | ||
{{CGscriptParameters_Template|Type=int|Name=<nowiki>idx</nowiki>|Description=<nowiki>Index of slide.</nowiki>|Comma=,}}{{CGscriptParameters_Template|Type=string|Name=<nowiki>name</nowiki>|Description=<nowiki>Name of table.</nowiki>|Comma=,}}{{CGscriptParameters_Template|Type=array|Name=<nowiki>coloredCells</nowiki>|Description=<nowiki>List of array objects in which describes the cell row, column and color specified by color (See Color_fromAny). E.g. {{1, 2, {255,0,0}}, {4, 5, new Color({255,0,0})}, {4, 5, "#FF0000"}}</nowiki>}} | {{CGscriptParameters_Template|Type=int|Name=<nowiki>idx</nowiki>|Description=<nowiki>Index of slide.</nowiki>|Comma=,}}{{CGscriptParameters_Template|Type=string|Name=<nowiki>name</nowiki>|Description=<nowiki>Name of table.</nowiki>|Comma=,}}{{CGscriptParameters_Template|Type=array|Name=<nowiki>coloredCells</nowiki>|Description=<nowiki>List of array objects in which describes the cell row, column and color specified by color (See Color_fromAny). E.g. {{1, 2, {255,0,0}}, {4, 5, new Color({255,0,0})}, {4, 5, "#FF0000"}}</nowiki>}} | ||
Line 180: | Line 185: | ||
{{CGscriptMethods_Template|ReturnType=Empty|Name=<nowiki>SetTableBackgroundColorPartiallyByHexString</nowiki>|Parameters= | {{CGscriptMethods_Template|ReturnType=Empty|Name=<nowiki>SetTableBackgroundColorPartiallyByHexString</nowiki>|Parameters= | ||
{{CGscriptParameters_Template|Type=int|Name=<nowiki>idx</nowiki>|Description=<nowiki>Index of slide.</nowiki>|Comma=,}}{{CGscriptParameters_Template|Type=string|Name=<nowiki>name</nowiki>|Description=<nowiki>Name of table.</nowiki>|Comma=,}}{{CGscriptParameters_Template|Type=array|Name=<nowiki>coloredCells</nowiki>|Description=<nowiki>See SetTableBackgroundColorPartially</nowiki>}} | {{CGscriptParameters_Template|Type=int|Name=<nowiki>idx</nowiki>|Description=<nowiki>Index of slide.</nowiki>|Comma=,}}{{CGscriptParameters_Template|Type=string|Name=<nowiki>name</nowiki>|Description=<nowiki>Name of table.</nowiki>|Comma=,}}{{CGscriptParameters_Template|Type=array|Name=<nowiki>coloredCells</nowiki>|Description=<nowiki>See SetTableBackgroundColorPartially</nowiki>}} | ||
− | |Description=<nowiki>Obsolete | + | |Obsolete=1 |
+ | |Description=<nowiki>[Obsolete] Same as SetTableBackgroundColorPartially.</nowiki>}} | ||
{{CGscriptMethods_Template|ReturnType=Empty|Name=<nowiki>SetTableBackgroundColorPartiallyByRGB</nowiki>|Parameters= | {{CGscriptMethods_Template|ReturnType=Empty|Name=<nowiki>SetTableBackgroundColorPartiallyByRGB</nowiki>|Parameters= | ||
{{CGscriptParameters_Template|Type=int|Name=<nowiki>idx</nowiki>|Description=<nowiki>Index of slide.</nowiki>|Comma=,}}{{CGscriptParameters_Template|Type=string|Name=<nowiki>name</nowiki>|Description=<nowiki>Name of table.</nowiki>|Comma=,}}{{CGscriptParameters_Template|Type=array|Name=<nowiki>coloredCells</nowiki>|Description=<nowiki>See SetTableBackgroundColorPartially</nowiki>}} | {{CGscriptParameters_Template|Type=int|Name=<nowiki>idx</nowiki>|Description=<nowiki>Index of slide.</nowiki>|Comma=,}}{{CGscriptParameters_Template|Type=string|Name=<nowiki>name</nowiki>|Description=<nowiki>Name of table.</nowiki>|Comma=,}}{{CGscriptParameters_Template|Type=array|Name=<nowiki>coloredCells</nowiki>|Description=<nowiki>See SetTableBackgroundColorPartially</nowiki>}} | ||
− | |Description=<nowiki>Obsolete | + | |Obsolete=1 |
+ | |Description=<nowiki>[Obsolete] Same as SetTableBackgroundColorPartially.</nowiki>}} | ||
{{CGscriptMethods_Template|ReturnType=Empty|Name=<nowiki>SetTableData</nowiki>|Parameters= | {{CGscriptMethods_Template|ReturnType=Empty|Name=<nowiki>SetTableData</nowiki>|Parameters= | ||
{{CGscriptParameters_Template|Type=int|Name=<nowiki>idx</nowiki>|Description=<nowiki>Index of slide.</nowiki>|Comma=,}}{{CGscriptParameters_Template|Type=string|Name=<nowiki>name</nowiki>|Description=<nowiki>Name of table.</nowiki>|Comma=,}}{{CGscriptParameters_Template|Type=array|Name=<nowiki>data</nowiki>|Description=<nowiki>Data for the table. E.g. {{'','Series 1'}, {'Category 1', 123.45}}.</nowiki>|Comma=,}}{{CGscriptParameters_Template|Type=bool|Name=<nowiki>keepTableWidth</nowiki>|Description=<nowiki>If true, the last col is split into minor cols. This will keep the width of the table. | {{CGscriptParameters_Template|Type=int|Name=<nowiki>idx</nowiki>|Description=<nowiki>Index of slide.</nowiki>|Comma=,}}{{CGscriptParameters_Template|Type=string|Name=<nowiki>name</nowiki>|Description=<nowiki>Name of table.</nowiki>|Comma=,}}{{CGscriptParameters_Template|Type=array|Name=<nowiki>data</nowiki>|Description=<nowiki>Data for the table. E.g. {{'','Series 1'}, {'Category 1', 123.45}}.</nowiki>|Comma=,}}{{CGscriptParameters_Template|Type=bool|Name=<nowiki>keepTableWidth</nowiki>|Description=<nowiki>If true, the last col is split into minor cols. This will keep the width of the table. | ||
Line 203: | Line 210: | ||
{{CGscriptProperties_Template|ReturnType=TypeInformation|Name=<nowiki>TypeInformation</nowiki>|HasGetter=1|Inherited=object|Description=<nowiki>Get information about this class.</nowiki>}} | {{CGscriptProperties_Template|ReturnType=TypeInformation|Name=<nowiki>TypeInformation</nowiki>|HasGetter=1|Inherited=object|Description=<nowiki>Get information about this class.</nowiki>}} | ||
}} | }} | ||
+ | |||
+ | === <span style="color:#DF8621">'''Related method'''</span> === | ||
+ | {{CGscriptMethods_Template|ReturnType=Color|Name=<nowiki>Color_fromAny</nowiki>|Parameters= | ||
+ | {{CGscriptParameters_Template|Type=object|Name=<nowiki>color</nowiki>|Description=<nowiki>Object to convert to color</nowiki>}} | ||
+ | |InClass=<nowiki>Color</nowiki> | ||
+ | |Description=<nowiki>Create new color object from anything that can be converted, E.g. {255,0,0}, {255,0,0,32}, "pink", "#FF0000", new Color("pink", false)</nowiki>}} | ||
=== <span style="color:#DF8621">'''Examples'''</span> === | === <span style="color:#DF8621">'''Examples'''</span> === | ||
+ | |||
+ | <span style="color:#DF8621">Example for using SetMapChartData</span> | ||
+ | <source lang="javascript"> | ||
+ | PptFile ppt = new PptFile(new Attachment(18953591)); | ||
+ | array geodata = {{"Region"},{"Hovedstaden"},{"Midtjylland"},{"Nordjylland"},{"Sjælland"},{"Syddanmark"}}; | ||
+ | array data = {{"Data"}, {0.4}, {0.10},{0.2},{0.1},{0.2}}; | ||
+ | ppt.SetMapChartData(1, "Diagram1", geodata, data,""); | ||
+ | ppt.SaveAllAsPptx("test.pptx", false); | ||
+ | print(getWebRoot()+ Catglobe.File.GetDownloadPath("test.pptx", false)); | ||
+ | </source> | ||
<span style="color:#DF8621">Example for using SetScatterDiagramData</span> | <span style="color:#DF8621">Example for using SetScatterDiagramData</span> | ||
Line 328: | Line 351: | ||
print(getWebRoot()+ Catglobe.File.GetDownloadPath(pptDownloadName, isTemp)); | print(getWebRoot()+ Catglobe.File.GetDownloadPath(pptDownloadName, isTemp)); | ||
+ | </source> | ||
+ | <span style="color:#DF8621">Example for: SetText</span> | ||
+ | <source lang="javascript"> | ||
+ | PptFile ppt = new PptFile(new Attachment(16751392)); | ||
+ | ppt.SetText(0,"Textbox1",{"consumption habits", 300, 60, 40}); | ||
+ | ppt.SaveAllAsPptx("test.pptx", false); | ||
+ | print(getWebRoot()+ Catglobe.File.GetDownloadPath("test.pptx", false)); | ||
+ | </source> | ||
+ | Text setup on template file (text fields follow .net style formatting codes. Ex: {0:0.0},{0:P1}): | ||
+ | |||
+ | [[File:2021-06-14_14-52-29.png]] | ||
+ | |||
+ | Result after run script: | ||
+ | |||
+ | [[File:2021-06-14_14-53-08.png]] | ||
+ | |||
+ | <span style="color:#DF8621">Example for SetTableBackgroundColor</span> | ||
+ | <source lang="javascript"> | ||
+ | PptFile ppt = new PptFile(new Attachment(15923133)); | ||
+ | array tableColor ={ | ||
+ | {},//Row1: using color from template | ||
+ | {"",{},"yellow","#FFFF00",{255,255,0},Color_fromAny("yellow")},//Row2 | ||
+ | //Row2: col1,2 using color from template; col3,4,5,6 set color yellow, col7++ not set (using color from template) | ||
+ | //Row3++ not set (using color from template) | ||
+ | }; | ||
+ | ppt.SetTableBackgroundColor(3, "table1", tableColor); | ||
+ | ppt.SaveAllAsPptx("testTableColor.pptx", false); | ||
+ | print(getWebRoot()+ Catglobe.File.GetDownloadPath("testTableColor.pptx", false)); | ||
+ | </source> | ||
+ | <span style="color:#DF8621">Example for: SetTableBackgroundColorPartially</span> | ||
+ | <source lang="javascript"> | ||
+ | PptFile ppt = new PptFile(new Attachment(15923133)); | ||
+ | array tableColor ={ | ||
+ | {0,0,"Yellow"} //{row1,col1,colorYellow} | ||
+ | {0,1,"#FFFF00"}, //{row1,col2,colorYellow} | ||
+ | {1,0,{255,255,0}}, //{row2,col1,colorYellow} | ||
+ | {1,2,Color_fromAny("yellow")} //{row2,col3,colorYellow} | ||
+ | }; | ||
+ | ppt.SetTableBackgroundColorPartially(3, "table1", tableColor); | ||
+ | ppt.SaveAllAsPptx("testTableColor.pptx", false); | ||
+ | print(getWebRoot()+ Catglobe.File.GetDownloadPath("testTableColor.pptx", false)); | ||
+ | </source> | ||
+ | <span style="color:#DF8621">Example for: SetBubbleDiagramData</span> | ||
+ | <source lang="javascript"> | ||
+ | PptFile ppt = new PptFile(new Attachment(15923121)); | ||
+ | array bubbleData = {{3,5,.3}, {2,7,1}, {4,7,2}};// {XValue, YValue, bubbleSize} | ||
+ | ppt.SetBubbleDiagramData(1, "chart1", bubbleData, ""); | ||
+ | ppt.SaveAllAsPptx("test.pptx", false); | ||
+ | print(getWebRoot()+ Catglobe.File.GetDownloadPath("test.pptx", false)); | ||
+ | </source> | ||
+ | |||
+ | <span style="color:#DF8621">Example for: SetDataPointSolidColor</span> | ||
+ | |||
+ | [[File:2021-05-24_14-16-05.jpg|500px]] | ||
+ | <source lang="javascript"> | ||
+ | PptFile ppt = new PptFile(new Attachment(15923121)); | ||
+ | number seriesIdx = 0; | ||
+ | number dataPointIdx = 0; | ||
+ | Color dataPointColor = Color_fromAny ("red"); | ||
+ | ppt.SetDataPointSolidColor(1, "Chart1", seriesIdx, dataPointIdx, dataPointColor); | ||
+ | ppt.SaveAllAsPptx("test.pptx", false); | ||
+ | print(getWebRoot()+ Catglobe.File.GetDownloadPath("test.pptx", false)); | ||
+ | </source> | ||
+ | |||
+ | <span style="color:#DF8621">Example for: SetDataPointGradientColor</span> | ||
+ | |||
+ | [[File:2021-05-24_14-29-45.jpg|500px]] | ||
+ | <source lang="javascript"> | ||
+ | PptFile ppt = new PptFile(new Attachment(15923121)); | ||
+ | number seriesIdx = 0; | ||
+ | number dataPointIdx = 0; | ||
+ | array gradientStops = {{0.1, "red"},{0.9, "black"}}; | ||
+ | ppt.SetDataPointGradientColor(1, "Chart1", seriesIdx, dataPointIdx, gradientStops); | ||
+ | ppt.SaveAllAsPptx("test.pptx", false); | ||
+ | print(getWebRoot()+ Catglobe.File.GetDownloadPath("test.pptx", false)); | ||
</source> | </source> |
Latest revision as of 03:55, 14 March 2023
PptFile
Manipulate PPT files.
Parent class
Inherits from object
Constructors
- () - Create new presentation.
- (Attachment attachment "Load from this attachment.") - Load existing presentation.
- (string source "Load from this source.", bool isTemp "Is source a temporary file.") - Load existing presentation.
Methods
- Empty AddImageToTextBox(Image imageCGO "An instance of ImageCGO", int idx "Index of slide.", string textBoxName "Name of textbox is used to find the image position.", int horizontalAlignment "Horizontal alignment", int verticalAlignment "Vertical alignment", number scaleX "Ratio is used to resize the image width. Scale up if ratio > 1, otherwise scale down and No scale when ratio <= 0", number scaleY "Ratio is used to resize the image heigh. Scale up if ratio > 1, otherwise scale down and No scale when ratio <= 0") - Put the image specified by the existing resource id on the n-th slide at the designed location determined by the text box.
- Empty AddImageToTextBox(Attachment attachmentCGO "An instance of AttachmentCGO", int idx "Index of slide.", string textBoxName "Name of textbox is used to find the image position.", int horizontalAlignment "Horizontal alignment", int verticalAlignment "Vertical alignment", number scaleX "Ratio is used to resize the image width. Scale up if ratio > 1, otherwise scale down and No scale when ratio <= 0", number scaleY "Ratio is used to resize the image heigh. Scale up if ratio > 1, otherwise scale down and No scale when ratio <= 0") - Put the image specified by the existing resource id on the n-th slide at the designed location determined by the text box.
- Empty AddImageToTextBox(string imageFileName "Image file name on CatGlobe.File", bool isTemp "Is temporary file", int idx "Index of slide.", string textBoxName "Name of textbox is used to find the image position.", int horizontalAlignment "Horizontal alignment", int verticalAlignment "Vertical alignment", number scaleX "Ratio is used to resize the image width. Scale up if ratio > 1, otherwise scale down and No scale when ratio <= 0", number scaleY "Ratio is used to resize the image heigh. Scale up if ratio > 1, otherwise scale down and No scale when ratio <= 0") - Put the image specified by the existing resource id on the n-th slide at the designed location determined by the text box.
- Empty AddImageToTextBoxInMaster(Image imageCGO "An instance of ImageCGO", string mastername "Name of the masterslide.", string layoutNameOrType "Layout from the master slide.", string name "Name of text box.", int horizontalAlignment "Horizontal alignment", int verticalAlignment "Vertical alignment", number scaleX "Ratio is used to resize the image width. Scale up if ratio > 1, otherwise scale down and No scale when ratio <= 0", number scaleY "Ratio is used to resize the image heigh. Scale up if ratio > 1, otherwise scale down and No scale when ratio <= 0") - Put the image specified by the existing resource id on the master slide at the designed location determined by the text box.
- Empty AddImageToTextBoxInMaster(Attachment attachmentCGO "An instance of AttachmentCGO", string mastername "Name of the masterslide.", string layoutNameOrType "Layout from the master slide.", string name "Name of text box.", int horizontalAlignment "Horizontal alignment", int verticalAlignment "Vertical alignment", number scaleX "Ratio is used to resize the image width. Scale up if ratio > 1, otherwise scale down and No scale when ratio <= 0", number scaleY "Ratio is used to resize the image heigh. Scale up if ratio > 1, otherwise scale down and No scale when ratio <= 0") - Put the image specified by the existing resource id on the master slide at the designed location determined by the text box.
- Empty AddImageToTextBoxInMaster(string imageFileName "Image file name on CatGlobe.File", bool isTemp "Is temporary file", string mastername "Name of the masterslide.", string layoutNameOrType "Layout from the master slide.", string name "Name of text box.", int horizontalAlignment "Horizontal alignment", int verticalAlignment "Vertical alignment", number scaleX "Ratio is used to resize the image width. Scale up if ratio > 1, otherwise scale down and No scale when ratio <= 0", number scaleY "Ratio is used to resize the image heigh. Scale up if ratio > 1, otherwise scale down and No scale when ratio <= 0") - Put the image specified by the existing resource id on the master slide at the designed location determined by the text box.
- Empty AddImageToTextBoxInMaster(Image imageCGO "An instance of ImageCGO", string mastername "Name of the masterslide.", string name "Name of text box.", int horizontalAlignment "Horizontal alignment", int verticalAlignment "Vertical alignment", number scaleX "Ratio is used to resize the image width. Scale up if ratio > 1, otherwise scale down and No scale when ratio <= 0", number scaleY "Ratio is used to resize the image heigh. Scale up if ratio > 1, otherwise scale down and No scale when ratio <= 0") - Put the image specified by the existing resource id on the particular master layout at the designed location determined by the text box.
- Empty AddImageToTextBoxInMaster(Attachment attachmentCGO "An instance of AttachmentCGO", string mastername "Name of the masterslide.", string name "Name of text box.", int horizontalAlignment "Horizontal alignment", int verticalAlignment "Vertical alignment", number scaleX "Ratio is used to resize the image width. Scale up if ratio > 1, otherwise scale down and No scale when ratio <= 0", number scaleY "Ratio is used to resize the image heigh. Scale up if ratio > 1, otherwise scale down and No scale when ratio <= 0") - Put the image specified by the existing resource id on the particular master layout at the designed location determined by the text box.
- Empty AddImageToTextBoxInMaster(string imageFileName "Image file name on CatGlobe.File", bool isTemp "Is temporary file", string mastername "Name of the masterslide.", string name "Name of text box.", int horizontalAlignment "Horizontal alignment", int verticalAlignment "Vertical alignment", number scaleX "Ratio is used to resize the image width. Scale up if ratio > 1, otherwise scale down and No scale when ratio <= 0", number scaleY "Ratio is used to resize the image heigh. Scale up if ratio > 1, otherwise scale down and No scale when ratio <= 0") - Put the image specified by the existing resource id on the particular master layout at the designed location determined by the text box.
- int AddSlide(string mastername "Name of the masterslide.", string layoutNameOrType "Layout name or type from the master slide.") - Add a new blank slide based on the given master slide.
- Empty Clear() - Remove all slides. Keep all master slides.
- int CloneSlide(PptFile source "Source of slide.", int idx "Index of slide in the source.", string localmastername "Name of the masterslide in the current presentation.") - Clone a slide from another presentation.
- int CloneSlide(PptFile source "Source of slide.", string name "Name of the slide in the source.", string localmastername "Name of the masterslide in the current presentation.") - Clone a slide from another presentation.
- int CloneSlideAndCloneMaster(PptFile source "Source of slide.", int idx "Index of slide in the source.") - Clone a slide from another presentation along with its master slide.
- int CloneSlideAndCloneMaster(PptFile source "Source of slide.", string name "Name of the slide in the source.") - Clone a slide from another presentation along with its master slide.
- Empty CopyCell(int originIdx "Index of slide.", string originName "Name of table.", int originRowIdx "Index of origin row.", int originColIdx "Index of origin col.", int destinationIdx "Index of slide.", string destinationName "Name of table.", int destinationRow "Index of destination row. Use -1 to apply to whole col.", int destinationCol "Index of destination col. Use -1 to apply to whole row.", bool preserveText "Keep current text in the destination cell.", bool preserveTextSimple "If false preserve full text formatting.") - Copy cell (including formatting) to other cell(s).
- Empty CopyDataPointFormat(int idx "Index of slide.", string name "Name of diagram.", int originSeries "Index of origin series.", int originCategory "Index of origin category.", int destinationSeries "Index of destination series.", int destinationCategory "Index of destination category.") - Copy the formatting of a datapoint to another.
- Empty CopyDataPointFormat(int originIdx "Index of slide.", string originName "Name of diagram.", int originSeries "Index of origin series.", int originCategory "Index of origin category.", int destinationIdx "Index of slide.", string name "Name of diagram.", int destinationSeries "Index of destination series.", int destinationCategory "Index of destination category.") - Copy the formatting of a datapoint from another chart to another.
- string CurrentLayoutType(int idx "Index of slide.") - Get the current layout type.
- string CurrentMasterName(int idx "Index of slide.") - Get the current master.
- array GetAllDiagrams(int idx "Index of slide.") - Return a list of diagram names that can be used in SetDiagram and other diagram functions.
- array GetAllMasterTextBoxes(string mastername "Name of the masterslide.", string layoutNameOrType "Layout from the master slide.") - Return a list of text box names that can be used in SetText for the given slide.
- array GetAllTables(int idx "Index of slide.") - Return a list of table names that can be used in SetDiagram and other diagram functions.
- array GetAllTextBoxes(int idx "Index of slide.") - Return a list of text box names that can be used in SetText for the given slide.
- array GetDiagramData(int idx "Index of slide.", string name "Name of diagram.") - Get the values of the diagram with the given name on the given slide to the values given.
- array GetLayoutTypesFromMaster(string name "Name of master.") - Get a list of all the layout types that belongs to a given master slide.
- array GetMasterNames() - Get a list of all the master slide names. The first is also the primary.
- int GetMasterSlideIdxByName(string name "Name of slide to find.") - Find a slide based on the name. Return -1 if not found.
- int GetMasterTextFields(string mastername "Name of the masterslide.", string layoutNameOrType "Layout from the master slide.", string name "Name of text box.") - Get the number of parameters needed to format the fields in the text box with the given name.
- int GetSlideIdxByName(string name "Name of slide to find.") - Find a slide based on the name. Return -1 if not found.
- int GetTextFields(int idx "Index of slide.", string name "Name of text box.") - Get the number of parameters needed to format the fields in the text box with the given name.
- Empty InsertEmptySlide(int positionToInsert "position to insert the new slide", int slideIndexToCopyLayout "the slide index to copy its layout") - Insert an empty slide at the specified position with the layout copied from an existing slide in the presentation
- Empty MoveSlideToPosition(int originSlideIdx "Index of slide to move.", int newSlideIdx "Put at this index.") - Move an existing slide to another position in the presentation.
- string Name(int idx "Index of slide.") - Get the name of the given slide.
- int NumberOfSlides() - Get the number of slides.
- Empty RemoveSlide(int idx "Index of slide to remove.") - Remove the given slide. All indexes of following slides are adjusted.
- Empty RenderSlideAsPng(int idx "Index of slide to render.", string dest "Save to this file.", bool isTemp "Is destination a temporary file.") - Render a slide as png image.
- string RenderSlideAsSvg(int idx "Index of slide to render.") - Render a slide as svg image.
- Empty SaveAll(string dest "Save to this file.", bool isTemp "Is destination a temporary file.", int saveFormatType "File Format To Save.") - Save presentation accordingly to specified format.
- Empty SaveAllAsPptx(string dest "Save to this file.", bool isTemp "Is destination a temporary file.") - Save presentation.
- Empty SetBubbleDiagramData(int idx "Index of slide.", string name "Name of diagram.", array data "Data for the table, as {'XValue', 'YValue', 'bubbleSize'}. E.g. {{5, 10, 20}, {2, 4, 6}}", string chartTitle "Title of the chart.") - Set the values of the diagram with the given name on the given slide to the values given.
- Empty SetDataPointGradientColor(int idx "Index of slide.", string name "Name of diagram.", int seriesIdx "Index of series. Notice bubble chart only has 1 series.", int dataPointIdx "Index of point in serie.", array gradientStops "Array of position, color. See Color_fromAny.") - Set the color of a specific data point in a chart.
- Empty SetDataPointSolidColor(int idx "Index of slide.", string name "Name of diagram.", int seriesIdx "Index of series. Notice bubble chart only has 1 series.", int dataPointIdx "Index of point in serie.", object color "See Color_fromAny.") - Set the color of a specific data point in a chart.
- Empty SetDiagram(int idx "Index of slide.", string name "Name of diagram.", int diagramIndex "Data for the table.", string chartTitle "Title of the chart.") - Set the values of the diagram with the given name on the given slide to the values generated by the diagram returned by createCrossDiagram or createFixedCrossTable.
- Empty SetDiagramData(int idx "Index of slide.", string name "Name of diagram.", array data "Data for the table. E.g. {{'','Series 1'}, {'Category 1', 123.45}}", string chartTitle "Title of the chart.") - Set the values of the diagram with the given name on the given slide to the values given.
- Empty SetFunnelDiagramData(int idx "Index of slide.", string name "Name of diagram.", array data "Data for the funnel diagram. E.g. {{'Cat01', 'Cat02', 'Cat03'}, {5, 10, 20}}", string chartTitle "Title of the chart.") - Set the values of the funnel diagram with the given name on the given slide to the values given.
- Empty SetHorizontalAxisMinMaxValues(int idx "Index of slide.", string name "Name of diagram.", number maxValue "Maximum value.", number minValue "Minimum value.") - Set the minimum and maximum values of the horizontal axis of the diagram with the given name on the given slide to the values given.
- Empty SetMapChartData(int idx "Index of slide.", string name "Name of diagram.", array geodata "Geo data for the table that helps Excel figure out what part of the map to highlight. E.g. {{'Province', 'County'}, {'Northern Ireland', 'Antrim'}, ...} or {{'Kommune'}, {'Glostrup'}, ...}", array data "Data for the series. E.g. {{'Series1'}, {10}, {4}, {7}}", string chartTitle "Title of the chart.") - Set the values of the diagram with the given name on the given slide to the values given.
- Empty SetMasterAndLayout(int idx "Index of slide.", string mastername "Name of the masterslide.", string layoutNameOrType "Layout from the master slide.") - Set the layout on the given slide to the layout from the given master.
- string SetMasterText(string mastername "Name of the masterslide.", string layoutNameOrType "Layout from the master slide.", string name "Name of text box.", array parameters "Parameters for the text box.") - Set parameters needed to format the fields in the text box with the given name on a specific layout of the master slide. Return resulting plain text value.
- string SetMasterText(string mastername "Name of the masterslide.", string name "Name of text box.", array parameters "Parameters for the text box.") - Set parameters needed to format the fields in the text box with the given name on a specific master slide. Return resulting plain text value.
- Empty SetScatterDiagramData(int idx "Index of slide.", string name "Name of diagram.", array data "Data for the table. E.g. {{'XValue', 'YValue-1', 'YValue-2'}, {5, 10, 20}, {2, 4, 6}}", string chartTitle "Title of the chart.") - Set the values of the diagram with the given name on the given slide to the values given.
- Empty SetScatterDiagramData(int idx "Index of slide.", string name "Name of diagram.", array data "Data for the table. E.g. {{'XValue', 'YValue-1', 'YValue-2'}, {5, 10, 20}, {2, 4, 6}}", array dataLabels "Label of data.", string chartTitle "Title of the chart.") - Set the values of the diagram with the given name on the given slide to the values given.
- Empty SetTable(int idx "Index of slide.", string name "Name of diagram.", int diagramIndex "Data for the table.", bool keepTableWidth "If true, the columnsare split into minor cols. This will keep the width of the table.
If false the columns are cloned, which will keep the size of cols, but table may then exceed the slide width.", bool keepTableHeight "If true, the rows are split into minor rows. This will keep the height of the table.
If false the last row is cloned, which will keep the size of rows, but table may then exceed the slide height.") - Set the values of the table with the given name on the given slide to the values generated by the diagram returned by createCrossDiagram or createFixedCrossTable.
- Empty SetTableBackgroundColor(int idx "Index of slide.", string name "Name of table.", array coloredCells "Color of cells See Color_fromAny") - Set background color for all cells in the table using array of colors.
- Empty SetTableBackgroundColorByHexString(int idx "Index of slide.", string name "Name of table.", array coloredCells "See SetTableBackgroundColor") - [Obsolete] Same as SetTableBackgroundColor.
- Empty SetTableBackgroundColorByRGB(int idx "Index of slide.", string name "Name of table.", array coloredCells "See SetTableBackgroundColor") - [Obsolete] Same as SetTableBackgroundColor.
- Empty SetTableBackgroundColorPartially(int idx "Index of slide.", string name "Name of table.", array coloredCells "List of array objects in which describes the cell row, column and color specified by color (See Color_fromAny). E.g. {{1, 2, {255,0,0}}, {4, 5, new Color({255,0,0})}, {4, 5, "#FF0000"}}") - Set background color of some of cells in the table using array of colors.
- Empty SetTableBackgroundColorPartiallyByHexString(int idx "Index of slide.", string name "Name of table.", array coloredCells "See SetTableBackgroundColorPartially") - [Obsolete] Same as SetTableBackgroundColorPartially.
- Empty SetTableBackgroundColorPartiallyByRGB(int idx "Index of slide.", string name "Name of table.", array coloredCells "See SetTableBackgroundColorPartially") - [Obsolete] Same as SetTableBackgroundColorPartially.
- Empty SetTableData(int idx "Index of slide.", string name "Name of table.", array data "Data for the table. E.g. {{'','Series 1'}, {'Category 1', 123.45}}.", bool keepTableWidth "If true, the last col is split into minor cols. This will keep the width of the table.
If false the last col is cloned, which will keep the size of cols, but table may then exceed the slide width.", bool keepTableHeight "If true, the last row is split into minor rows. This will keep the height of the table.
If false the last row is cloned, which will keep the size of rows, but table may then exceed the slide height.") - Set the values of the table with the given name on the given slide to the values given.
- string SetText(int idx "Index of slide.", string name "Name of text box.", array parameters "Parameters for the text box.") - Get the number of parameters needed to format the fields in the text box with the given name. Return resulting plain text value.
- Empty SetVerticalAxisMinMaxValues(int idx "Index of slide.", string name "Name of diagram.", number maxValue "Maximum value.", number minValue "Minimum value.") - Set the minimum and maximum values of the vertical axis of the diagram with the given name on the given slide to the values given.
- Empty SwapDataPointFormat(int idx "Index of slide.", string name "Name of diagram.", int originSeries "Index of origin series.", int originCategory "Index of origin category.", int destinationSeries "Index of destination series.", int destinationCategory "Index of destination category.") - Swap the formatting of two datapoints.
- (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.
Related method
- Color Color_fromAny(object color "Object to convert to color") - Create new color object from anything that can be converted, E.g. {255,0,0}, {255,0,0,32}, "pink", "#FF0000", new Color("pink", false)
Examples
Example for using SetMapChartData
PptFile ppt = new PptFile(new Attachment(18953591));
array geodata = {{"Region"},{"Hovedstaden"},{"Midtjylland"},{"Nordjylland"},{"Sjælland"},{"Syddanmark"}};
array data = {{"Data"}, {0.4}, {0.10},{0.2},{0.1},{0.2}};
ppt.SetMapChartData(1, "Diagram1", geodata, data,"");
ppt.SaveAllAsPptx("test.pptx", false);
print(getWebRoot()+ Catglobe.File.GetDownloadPath("test.pptx", false));
Example for using SetScatterDiagramData
//Create ppt file with an Attachment
number pptLayoutTemplateRid = 15562782;
Attachment pptLayoutTemplateFile = new Attachment(pptLayoutTemplateRid);
PptFile ppt = new PptFile(pptLayoutTemplateFile);
//scatterdata for slide 0
number slideIndex = 0;
string diagramName = "Content Placeholder 7";
array scatterdata = {{"x-values", "y value 1", "y value 2"},{1,5,3}, {2,6,2},{3,10,11},{4,15,16}};
string chartTitle= "Check scatterdata";
ppt.SetScatterDiagramData( slideIndex, diagramName, scatterdata, chartTitle);
//Save to pptx file
string pptDownloadName = "test.pptx";
bool isTemp = false;
ppt.SaveAllAsPptx(pptDownloadName, isTemp);
//print link to download the ppts file
print(getWebRoot()+ Catglobe.File.GetDownloadPath(pptDownloadName, isTemp));
//http://cghead.catglobe.com/Public/CgsFile.aspx?file=test.pptx
Example for using AddImageToTextBox
//Create ppt file with an Attachment
number pptLayoutTemplateRid = 15596830;
Attachment pptLayoutTemplateFile = new Attachment(pptLayoutTemplateRid);
PptFile ppt = new PptFile(pptLayoutTemplateFile);
//AddImageToTextBox
number imageAttachmentRId = 15596380;
Attachment imageAttachment = new Attachment(imageAttachmentRId);
number idx = 0;
string textBoxName = "TextBox 2";
number horizontalAlignment=0;//Left, Center, Right [-1, 1]
number verticalAlignment=0;//Top, Middle, Bottom [-1, 1]
number scaleX = 0;
number scaleY = 0;
ppt.AddImageToTextBox(imageAttachment, idx, textBoxName, horizontalAlignment, verticalAlignment, scaleX, scaleY);
//Save to pptx file
string pptDownloadName = "test.pptx";
bool isTemp = false;
ppt.SaveAllAsPptx(pptDownloadName, isTemp);
//print link to download the ppts file
print(getWebRoot()+ Catglobe.File.GetDownloadPath(pptDownloadName, isTemp));
//http://cghead.catglobe.com/Public/CgsFile.aspx?file=test.pptx
Example for using AddImageToTextBoxInMaster
//Create ppt file with an Attachment
number pptLayoutTemplateRid = 15596830;
Attachment pptLayoutTemplateFile = new Attachment(pptLayoutTemplateRid);
PptFile ppt = new PptFile(pptLayoutTemplateFile);
//AddImageToTextBox
Image im = new Image(15597063);
string masterName = "Master 1";
string textBoxName = "TextBox 2";
number horizontalAlignment=1;//Left, Center, Right [-1, 1]
number verticalAlignment=1;//Top, Middle, Bottom [-1, 1]
number scaleX = 0;
number scaleY = 0;
ppt.AddImageToTextBoxInMaster(im, masterName, textBoxName, horizontalAlignment, verticalAlignment, scaleX, scaleY);
//Save to pptx file
string pptDownloadName = "test.pptx";
bool isTemp = false;
ppt.SaveAllAsPptx(pptDownloadName, isTemp);
//print link to download the ppts file
print(getWebRoot()+ Catglobe.File.GetDownloadPath(pptDownloadName, isTemp));
//http://cghead.catglobe.com/Public/CgsFile.aspx?file=test.pptx
Example for CopyCell
number pptLayoutTemplateRid = 15599667;
Attachment pptLayoutTemplateFile = new Attachment(pptLayoutTemplateRid);
PptFile ppt = new PptFile(pptLayoutTemplateFile);
//CopyCell
number originIdx = 0;//"Index of slide."
string originName = "Table1";//"Name of table."
number originRowIdx = 0;//"Index of origin row."
number originColIdx = 0;//"Index of origin col."
number destinationIdx = 0;//"Index of slide."
string destinationName = "Table2";//"Name of table."
number destinationRow = 0;//"Index of destination row. Use -1 to apply to whole col."
number destinationCol = 0;//"Index of destination col. Use -1 to apply to whole row."
bool preserveText = false;//"Keep current text in the destination cell."
bool preserveTextSimple = false;//"If false preserve full text formatting."
ppt.CopyCell(originIdx, originName, originRowIdx, originColIdx, destinationIdx, destinationName, destinationRow, destinationCol, preserveText, preserveTextSimple);
//Save to pptx file
string pptDownloadName = "test.pptx";
bool isTemp = false;
ppt.SaveAllAsPptx(pptDownloadName, isTemp);
//print link to download the ppts file
print(getWebRoot()+ Catglobe.File.GetDownloadPath(pptDownloadName, isTemp));
//http://cghead.catglobe.com/Public/CgsFile.aspx?file=test.pptx
Example for: CopyDataPointFormat
//Create ppt file with an Attachment
number pptLayoutTemplateRid = 15639264;
Attachment pptLayoutTemplateFile = new Attachment(pptLayoutTemplateRid);
PptFile ppt = new PptFile(pptLayoutTemplateFile);
//CopyDataPointFormat
number originidx = 0;
string originname = "Chart";
number originSeries = 0;
number originCategory = 4;
number idx =0;
string name = "Chart";
number destinationSeries = 0;
number destinationCategory = 2;
ppt.CopyDataPointFormat(originidx, originname, originSeries, originCategory, idx, name, destinationSeries, destinationCategory);
//Save to pptx file
string pptDownloadName = "test.pptx";
bool isTemp = false;
ppt.SaveAllAsPptx(pptDownloadName, isTemp);
//print link to download the ppts file
print(getWebRoot()+ Catglobe.File.GetDownloadPath(pptDownloadName, isTemp));
Example for: SetText
PptFile ppt = new PptFile(new Attachment(16751392));
ppt.SetText(0,"Textbox1",{"consumption habits", 300, 60, 40});
ppt.SaveAllAsPptx("test.pptx", false);
print(getWebRoot()+ Catglobe.File.GetDownloadPath("test.pptx", false));
Text setup on template file (text fields follow .net style formatting codes. Ex: {0:0.0},{0:P1}):
Result after run script:
Example for SetTableBackgroundColor
PptFile ppt = new PptFile(new Attachment(15923133));
array tableColor ={
{},//Row1: using color from template
{"",{},"yellow","#FFFF00",{255,255,0},Color_fromAny("yellow")},//Row2
//Row2: col1,2 using color from template; col3,4,5,6 set color yellow, col7++ not set (using color from template)
//Row3++ not set (using color from template)
};
ppt.SetTableBackgroundColor(3, "table1", tableColor);
ppt.SaveAllAsPptx("testTableColor.pptx", false);
print(getWebRoot()+ Catglobe.File.GetDownloadPath("testTableColor.pptx", false));
Example for: SetTableBackgroundColorPartially
PptFile ppt = new PptFile(new Attachment(15923133));
array tableColor ={
{0,0,"Yellow"} //{row1,col1,colorYellow}
{0,1,"#FFFF00"}, //{row1,col2,colorYellow}
{1,0,{255,255,0}}, //{row2,col1,colorYellow}
{1,2,Color_fromAny("yellow")} //{row2,col3,colorYellow}
};
ppt.SetTableBackgroundColorPartially(3, "table1", tableColor);
ppt.SaveAllAsPptx("testTableColor.pptx", false);
print(getWebRoot()+ Catglobe.File.GetDownloadPath("testTableColor.pptx", false));
Example for: SetBubbleDiagramData
PptFile ppt = new PptFile(new Attachment(15923121));
array bubbleData = {{3,5,.3}, {2,7,1}, {4,7,2}};// {XValue, YValue, bubbleSize}
ppt.SetBubbleDiagramData(1, "chart1", bubbleData, "");
ppt.SaveAllAsPptx("test.pptx", false);
print(getWebRoot()+ Catglobe.File.GetDownloadPath("test.pptx", false));
Example for: SetDataPointSolidColor
PptFile ppt = new PptFile(new Attachment(15923121));
number seriesIdx = 0;
number dataPointIdx = 0;
Color dataPointColor = Color_fromAny ("red");
ppt.SetDataPointSolidColor(1, "Chart1", seriesIdx, dataPointIdx, dataPointColor);
ppt.SaveAllAsPptx("test.pptx", false);
print(getWebRoot()+ Catglobe.File.GetDownloadPath("test.pptx", false));
Example for: SetDataPointGradientColor
PptFile ppt = new PptFile(new Attachment(15923121));
number seriesIdx = 0;
number dataPointIdx = 0;
array gradientStops = {{0.1, "red"},{0.9, "black"}};
ppt.SetDataPointGradientColor(1, "Chart1", seriesIdx, dataPointIdx, gradientStops);
ppt.SaveAllAsPptx("test.pptx", false);
print(getWebRoot()+ Catglobe.File.GetDownloadPath("test.pptx", false));