ComHelper Class
Contains methods that can be useful for users which are calling GemBox.Presentation component using COM interop.
- Inheritance:
- System.ObjectComHelper
Constructors
ComHelper()
Initializes a new instance of the ComHelper class.
Methods
AddNewSlide(Object, Object)
Adds a new Slide with the specified parent layout template to the end of the collection.
public Slide AddNewSlide(object slides, object layoutSlide)
Public Function AddNewSlide(slides As Object, layoutSlide As Object) As Slide
Parameters
slides
- System.Object
A Slides collection.
layoutSlide
- System.Object
The parent layout template of a new Slide.
Returns
ComSetLicense(String)
Call this method from your application to set GemBox.Presentation serial key.
Parameters
serialKey
- System.String
The serial key.
Remarks
You should call this method before using any other class from GemBox.Presentation assembly.
Key can only be set once (if you try another key, exception will be thrown).
The best place to call this method is from static constructor of your application's main class.
Valid serial key has multiple groups of alphanumeric characters, separated with dashes.
To use the assembly in free limited mode use FREE-LIMITED-KEY as serialKey
.
For more information about GemBox.Presentation evaluation and licensing, see evaluation and licensing.
CreateColor(Int32, Int32, Int32)
Creates a new color instance from the specified Red, Green and Blue components.
public Color CreateColor(int r, int g, int b)
Public Function CreateColor(r As Integer, g As Integer, b As Integer) As Color
Parameters
r
- System.Int32
The Red component (from 0 to 255).
g
- System.Int32
The Green component (from 0 to 255).
b
- System.Int32
The Blue component (from 0 to 255).
Returns
A new color instance from the specified Red, Green and Blue components.
GetCollectionCount(Object)
Gets the number of items contained in the collection.
public int GetCollectionCount(object collection)
Public Function GetCollectionCount(collection As Object) As Integer
Parameters
collection
- System.Object
The Collection-derived instance.
Returns
- System.Int32
The number of items contained in the collection.
GetCollectionItem(Object, Int32)
Gets the item at the specified index.
public object GetCollectionItem(object collection, int index)
Public Function GetCollectionItem(collection As Object, index As Integer) As Object
Parameters
collection
- System.Object
The Collection-derived instance.
index
- System.Int32
The zero-based index of the item to get.
Returns
- System.Object
The item at the specified index.
Load(String)
Loads a presentation from a file with the specified path.
public PresentationDocument Load(string path)
Public Function Load(path As String) As PresentationDocument
Parameters
path
- System.String
The path from which to load a presentation.
Returns
A loaded presentation.
Remarks
File extension that is extracted from the path
is used to create the appropriate LoadOptions derived class instance that is then passed to the Load(String, LoadOptions) method.
Following file extensions are supported:
- Microsoft PowerPoint: .pptx, .pptm, .ppsx, .ppsm, .potx, .potm
Exceptions
- System.InvalidOperationException
If file extension is not specified or not supported. If file extension is not recognized, use Load(String, LoadOptions) method overload instead.
LoadWithOptions(String, Object)
Loads a presentation from a file with the specified path.
public PresentationDocument LoadWithOptions(string path, object options)
Public Function LoadWithOptions(path As String, options As Object) As PresentationDocument
Parameters
path
- System.String
The path from which to load a presentation.
options
- System.Object
The loading options which can be used to define settings for load operation.
Returns
A loaded presentation.
RemoveCollectionItemAt(Object, Int32)
Removes the item at the specified index of the collection.
public void RemoveCollectionItemAt(object collection, int index)
Public Sub RemoveCollectionItemAt(collection As Object, index As Integer)
Parameters
collection
- System.Object
The Collection-derived instance.
index
- System.Int32
The zero-based index of the item to remove.
SaveWithOptions(Object, String, Object)
Saves the presentation to a file with the specified path.
public void SaveWithOptions(object presentation, string path, object options)
Public Sub SaveWithOptions(presentation As Object, path As String, options As Object)
Parameters
presentation
- System.Object
The PresentationDocument instance which to save.
path
- System.String
The path to which to save the presentation.
options
- System.Object
The saving options which can be used to define settings for save operation.