Tablo

Aspose.Slides for .NET kullanarak tablo ekleme, tabloya erişme, tablo silme ve hücre birleştirme örnekleri.

Tablo Ekle

İki satır ve iki sütundan oluşan basit bir tablo oluşturun.

static void AddTable()
{
    using var presentation = new Presentation();
    var slide = presentation.Slides[0];

    double[] widths = { 80, 80 };
    double[] heights = { 30, 30 };
    var table = slide.Shapes.AddTable(50, 50, widths, heights);
}

Tabloya Eriş

Slayttaki ilk tablo şekline erişin.

static void AccessTable()
{
    using var presentation = new Presentation();
    var slide = presentation.Slides[0];

    double[] widths = { 80, 80 };
    double[] heights = { 30, 30 };
    var table = slide.Shapes.AddTable(50, 50, widths, heights);

    // Slayttaki ilk tabloya eriş.
    var firstTable = slide.Shapes.OfType<ITable>().First();
}

Tabloyu Kaldır

Bir slayttan tabloyu silin.

static void RemoveTable()
{
    using var presentation = new Presentation();
    var slide = presentation.Slides[0];

    double[] widths = { 80, 80 };
    double[] heights = { 30, 30 };
    var table = slide.Shapes.AddTable(50, 50, widths, heights);

    slide.Shapes.Remove(table);
}

Tablo Hücrelerini Birleştir

Bir tablonun yan yana hücrelerini tek bir hücreye birleştirin.

static void MergeTableCells()
{
    using var presentation = new Presentation();
    var slide = presentation.Slides[0];
    
    double[] widths = { 80, 80 };
    double[] heights = { 30, 30 };
    var table = slide.Shapes.AddTable(50, 50, widths, heights);

    table.MergeCells(table[0, 0], table[1, 1], false);
}