Difference between revisions of "PptFile class"

From Catglobe Wiki
Jump to: navigation, search
(Tag: visualeditor-switched)
Line 97: Line 97:
 
{{CGscriptMethods_Template|ReturnType=Empty|Name=<nowiki>SetImage</nowiki>|Parameters=
 
{{CGscriptMethods_Template|ReturnType=Empty|Name=<nowiki>SetImage</nowiki>|Parameters=
 
{{CGscriptParameters_Template|Type=int|Name=<nowiki>imageResourceId</nowiki>|Description=<nowiki>Image Resource Id</nowiki>|Comma=,}}{{CGscriptParameters_Template|Type=int|Name=<nowiki>idx</nowiki>|Description=<nowiki>Index of slide.</nowiki>|Comma=,}}{{CGscriptParameters_Template|Type=string|Name=<nowiki>textBoxName</nowiki>|Description=<nowiki>Name of textbox is used to find the image position.</nowiki>}}
 
{{CGscriptParameters_Template|Type=int|Name=<nowiki>imageResourceId</nowiki>|Description=<nowiki>Image Resource Id</nowiki>|Comma=,}}{{CGscriptParameters_Template|Type=int|Name=<nowiki>idx</nowiki>|Description=<nowiki>Index of slide.</nowiki>|Comma=,}}{{CGscriptParameters_Template|Type=string|Name=<nowiki>textBoxName</nowiki>|Description=<nowiki>Name of textbox is used to find the image position.</nowiki>}}
|Description=<nowiki>Put the image specified by the existing resource id at the designed location </nowiki>}}
+
|Description=<nowiki>Put the image specified by the existing resource id on the n-th slide at the designed location determined by the text box.</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>}}
 
|Description=<nowiki>Set the layout on the given slide to the layout from the given master.</nowiki>}}
 
|Description=<nowiki>Set the layout on the given slide to the layout from the given master.</nowiki>}}
 +
{{CGscriptMethods_Template|ReturnType=Empty|Name=<nowiki>SetMasterImage</nowiki>|Parameters=
 +
{{CGscriptParameters_Template|Type=int|Name=<nowiki>imageResourceId</nowiki>|Description=<nowiki>Image Resource Id</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>|Comma=,}}{{CGscriptParameters_Template|Type=string|Name=<nowiki>name</nowiki>|Description=<nowiki>Name of text box.</nowiki>}}
 +
|Description=<nowiki>Put the image specified by the existing resource id on the master slide at the designed location determined by the text box.</nowiki>}}
 +
{{CGscriptMethods_Template|ReturnType=Empty|Name=<nowiki>SetMasterImage</nowiki>|Parameters=
 +
{{CGscriptParameters_Template|Type=int|Name=<nowiki>imageResourceId</nowiki>|Description=<nowiki>Image Resource Id</nowiki>|Comma=,}}{{CGscriptParameters_Template|Type=string|Name=<nowiki>mastername</nowiki>|Description=<nowiki>Name of the masterslide.</nowiki>|Comma=,}}{{CGscriptParameters_Template|Type=string|Name=<nowiki>name</nowiki>|Description=<nowiki>Name of text box.</nowiki>}}
 +
|Description=<nowiki>Put the image specified by the existing resource id on the particular master layout at the designed location determined by the text box.</nowiki>}}
 
{{CGscriptMethods_Template|ReturnType=string|Name=<nowiki>SetMasterText</nowiki>|Parameters=
 
{{CGscriptMethods_Template|ReturnType=string|Name=<nowiki>SetMasterText</nowiki>|Parameters=
 
{{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>|Comma=,}}{{CGscriptParameters_Template|Type=string|Name=<nowiki>name</nowiki>|Description=<nowiki>Name of text box.</nowiki>|Comma=,}}{{CGscriptParameters_Template|Type=array|Name=<nowiki>parameters</nowiki>|Description=<nowiki>Parameters for the text box.</nowiki>}}
 
{{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>|Comma=,}}{{CGscriptParameters_Template|Type=string|Name=<nowiki>name</nowiki>|Description=<nowiki>Name of text box.</nowiki>|Comma=,}}{{CGscriptParameters_Template|Type=array|Name=<nowiki>parameters</nowiki>|Description=<nowiki>Parameters for the text box.</nowiki>}}
|Description=<nowiki>Get the number of parameters needed to format the fields in the text box with the given name. Return resulting plain text value.</nowiki>}}
+
|Description=<nowiki>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.</nowiki>}}
 +
{{CGscriptMethods_Template|ReturnType=string|Name=<nowiki>SetMasterText</nowiki>|Parameters=
 +
{{CGscriptParameters_Template|Type=string|Name=<nowiki>mastername</nowiki>|Description=<nowiki>Name of the masterslide.</nowiki>|Comma=,}}{{CGscriptParameters_Template|Type=string|Name=<nowiki>name</nowiki>|Description=<nowiki>Name of text box.</nowiki>|Comma=,}}{{CGscriptParameters_Template|Type=array|Name=<nowiki>parameters</nowiki>|Description=<nowiki>Parameters for the text box.</nowiki>}}
 +
|Description=<nowiki>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.</nowiki>}}
 
{{CGscriptMethods_Template|ReturnType=Empty|Name=<nowiki>SetScatterDiagramData</nowiki>|Parameters=
 
{{CGscriptMethods_Template|ReturnType=Empty|Name=<nowiki>SetScatterDiagramData</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>data</nowiki>|Description=<nowiki>Data for the table. E.g. {{'XValue', 'YValue-1', 'YValue-2'}, {5, 10, 20}, {2, 4, 6}}</nowiki>|Comma=,}}{{CGscriptParameters_Template|Type=string|Name=<nowiki>chartTitle</nowiki>|Description=<nowiki>Title of the chart.</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=array|Name=<nowiki>data</nowiki>|Description=<nowiki>Data for the table. E.g. {{'XValue', 'YValue-1', 'YValue-2'}, {5, 10, 20}, {2, 4, 6}}</nowiki>|Comma=,}}{{CGscriptParameters_Template|Type=array|Name=<nowiki>dataLabels</nowiki>|Description=<nowiki>Label of data.</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>}}
 
|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>SetTable</nowiki>|Parameters=
 
{{CGscriptMethods_Template|ReturnType=Empty|Name=<nowiki>SetTable</nowiki>|Parameters=

Revision as of 10:11, 2 August 2017

PptFile



Manipulate PPT files.

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

  • 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 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 idx "Index of slide.", string name "Name of diagram.", int originSeries "Index of origin series.", int originCategory "Index of origin category.", int idx "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.
  • 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 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 SetImage(int imageResourceId "Image Resource Id", int idx "Index of slide.", string textBoxName "Name of textbox is used to find the image position.") - Put the image specified by the existing resource id on the n-th slide at the designed location determined by the text box.
  • 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.
  • Empty SetMasterImage(int imageResourceId "Image Resource Id", string mastername "Name of the masterslide.", string layoutNameOrType "Layout from the master slide.", string name "Name of text box.") - Put the image specified by the existing resource id on the master slide at the designed location determined by the text box.
  • Empty SetMasterImage(int imageResourceId "Image Resource Id", string mastername "Name of the masterslide.", string name "Name of text box.") - Put the image specified by the existing resource id on the particular master layout at the designed location determined by the text box.
  • 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}}", 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 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 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.
  • string ToString() - The string representation of the object.

Properties

  • string ObjectTypeName { get; } - The name of the type of object.
  • TypeInformation TypeInformation { get; } - Get information about this class.


Examples

//**********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