AddTableFromWorkbook
Contents
[
Hide
]AddTableFromWorkbook(IShapeCollection, float, float, IExcelDataWorkbook, string, string)
Retrieves a table from the specified Excel workbook and adds it to the end of the given shape collection at the specified coordinates.
public static ITable AddTableFromWorkbook(IShapeCollection shapes, float x, float y,
IExcelDataWorkbook workbook, string worksheetName, string cellRange)
| Parameter | Type | Description |
|---|---|---|
| shapes | IShapeCollection | The shape collection to which the table will be added. |
| x | Single | The X coordinate for positioning the table. |
| y | Single | The Y coordinate for positioning the table. |
| workbook | IExcelDataWorkbook | The Excel workbook. |
| worksheetName | String | The name of the worksheet that contains the table. |
| cellRange | String | The cell range that defines the table (for example, “A1:D10”). |
Return Value
The table that was added to the shape collection.
Exceptions
| exception | condition |
|---|---|
| ArgumentException | Thrown when any required parameter is null or empty, or when the specified worksheet or cell range is invalid. |
| InvalidOperationException | Thrown when the input data is in an unsupported format. |
Examples
[C#]
IExcelDataWorkbook workbook = new ExcelDataWorkbook(testFile);
using (var pres = new Presentation())
{
ExcelWorkbookImporter.AddTableFromWorkbook(pres.Slides[0].Shapes, 10, 10, workbook, worksheetName, "A1:D10");
pres.Save("result.pptx", SaveFormat.Pptx);
}
See Also
- interface ITable
- interface IShapeCollection
- interface IExcelDataWorkbook
- class ExcelWorkbookImporter
- namespace Aspose.Slides.Import
- assembly Aspose.Slides
AddTableFromWorkbook(IShapeCollection, float, float, string, string, string)
Retrieves a table from the specified Excel workbook file and adds it to the end of the given shape collection at the specified coordinates.
public static ITable AddTableFromWorkbook(IShapeCollection shapes, float x, float y,
string workbookPath, string worksheetName, string cellRange)
| Parameter | Type | Description |
|---|---|---|
| shapes | IShapeCollection | The shape collection to which the table will be added. |
| x | Single | The X coordinate for positioning the table. |
| y | Single | The Y coordinate for positioning the table. |
| workbookPath | String | The path to the Excel workbook file. |
| worksheetName | String | The name of the worksheet that contains the table. |
| cellRange | String | The cell range that defines the table (for example, “A1:D10”). |
Return Value
The table that was added to the shape collection.
Exceptions
| exception | condition |
|---|---|
| ArgumentException | Thrown when any required parameter is null or empty, or when the specified worksheet or cell range is invalid. |
| IOException | Thrown when an I/O error occurs while accessing the workbook file. |
| InvalidOperationException | Thrown when the input data is in an unsupported format. |
Examples
[C#]
using (var pres = new Presentation())
{
ExcelWorkbookImporter.AddTableFromWorkbook(pres.Slides[0].Shapes, 10, 10, workbookPath, worksheetName, "A1:D10");
pres.Save("result.pptx", SaveFormat.Pptx);
}
See Also
- interface ITable
- interface IShapeCollection
- class ExcelWorkbookImporter
- namespace Aspose.Slides.Import
- assembly Aspose.Slides
AddTableFromWorkbook(IShapeCollection, float, float, Stream, string, string)
Retrieves a table from the specified Excel workbook file and adds it to the end of the given shape collection at the specified coordinates.
public static ITable AddTableFromWorkbook(IShapeCollection shapes, float x, float y,
Stream workbookStream, string worksheetName, string cellRange)
| Parameter | Type | Description |
|---|---|---|
| shapes | IShapeCollection | The shape collection to which the table will be added. |
| x | Single | The X coordinate for positioning the table. |
| y | Single | The Y coordinate for positioning the table. |
| workbookStream | Stream | A stream containing the workbook data. |
| worksheetName | String | The name of the worksheet that contains the table. |
| cellRange | String | The cell range that defines the table (for example, “A1:D10”). |
Return Value
The table that was added to the shape collection.
Exceptions
| exception | condition |
|---|---|
| ArgumentException | Thrown when any required parameter is null or empty, or when the specified worksheet or cell range is invalid. |
| InvalidOperationException | Thrown when the input data is in an unsupported format. |
Examples
[C#]
using (var fStream = new FileStream(workbookPath, FileMode.Open, FileAccess.Read))
using (var pres = new Presentation())
{
ExcelWorkbookImporter.AddTableFromWorkbook(pres.Slides[0].Shapes, 10, 10, fStream, worksheetName, "A1:D10");
pres.Save("result.pptx", SaveFormat.Pptx);
}
See Also
- interface ITable
- interface IShapeCollection
- class ExcelWorkbookImporter
- namespace Aspose.Slides.Import
- assembly Aspose.Slides