PptFile class
Revision as of 08:20, 1 November 2017 by Nguyenduyan (talk | contribs)
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
- 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 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 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 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
//**********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;
//ScaleToX, ScaleToY, ScaleToXAndY, ScaleDownToX, ScaleDownToY, ScaleDownToXAndY.
//Down version only scales if image is larger than textbox. XAndY does not preserve aspect ratio, the others do.
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