officefileapi-devexpress-dot-docs-dot-presentation-dot-tablecell.md
Gets or sets the table cell text box that allows you specify cell content and its formatting.
Namespace : DevExpress.Docs.Presentation
Assembly : DevExpress.Docs.Presentation.v25.2.dll
NuGet Package : DevExpress.Docs.Presentation
public CellTextArea TextArea { get; set; }
Public Property TextArea As CellTextArea
| Type | Description |
|---|---|
| CellTextArea |
A table cell text box.
|
For more information about tables, refer to the following help topic: DevExpress Presentation API Library: Work with Tables.
Follow the steps below to create a table and add it to a slide:
Table constructor.Table constructor.TextArea property to add text to the cell. Note that cells support only text content.The following code snippet creates a 3x3 table, adds it to a slide, and populates the cells with text:
using DevExpress.Docs.Presentation;
namespace PresentationApiSample;
public class Program {
public static void Main(string[] _) {
// Create an in-memory Presentation document
Presentation presentation = new Presentation();
presentation.Slides.Clear();
// Create a blank slide and add it to the presentation
Slide slide = new Slide(SlideLayoutType.Blank);
presentation.Slides.Add(slide);
// Create a 3x3 table (rows x columns), specify its position and size, and add the table as a shape to the slide
Table table = new Table(3, 3);
table.X = 10;
table.Y = 10;
table.Width = 2500;
table.Height = 2000;
slide.Shapes.Add(table);
// Populate table cell text (row, column)
for (int row = 0; row < 3; row++) {
for (int column = 0; column < 3; column++) {
table[row, column].TextArea.Text = $"({row}, {column})";
}
}
// Export the presentation to PDF
presentation.ExportToPdf(new FileStream(@"D:\\exported-document.pdf", FileMode.Create));
// Save the presentation as a PPTX file
FileStream outputStream = new FileStream(@"D:\\presentation.pptx", FileMode.Create);
presentation.SaveDocument(outputStream, DocumentFormat.Pptx);
outputStream.Dispose();
}
}
Imports DevExpress.Docs.Presentation
Namespace PresentationApiSample
Public Class Program
Public Shared Sub Main(__ As String())
' Create an in-memory Presentation document
Dim presentation As Presentation = New Presentation()
presentation.Slides.Clear()
' Create a blank slide and add it to the presentation
Dim slide As Slide = New Slide(SlideLayoutType.Blank)
presentation.Slides.Add(slide)
' Create a 3x3 table (rows x columns), specify its position and size, and add the table as a shape to the slide
Dim table As Table = New Table(3, 3)
table.X = 10
table.Y = 10
table.Width = 2500
table.Height = 2000
slide.Shapes.Add(table)
' Populate table cell text (row, column)
For row As Integer = 0 To 2
For column As Integer = 0 To 2
table(row, column).TextArea.Text = $"({row}, {column})"
Next
Next
' Export the presentation to PDF
presentation.ExportToPdf(New FileStream("D:\\exported-document.pdf", FileMode.Create))
' Save the presentation as a PPTX file
Dim outputStream As FileStream = New FileStream("D:\\presentation.pptx", FileMode.Create)
presentation.SaveDocument(outputStream, DocumentFormat.Pptx)
outputStream.Dispose()
End Sub
End Class
End Namespace
See Also