टेबल

Aspose.Slides for Python via .NET का उपयोग करके तालिकाएँ जोड़ने, उनका एक्सेस करने, उन्हें हटाने और सेल्स को मर्ज करने के उदाहरण।

तालिका जोड़ें

दो पंक्तियों और दो स्तंभों वाली एक साधारण तालिका बनाएँ।

def add_table():
    with slides.Presentation() as presentation:
        slide = presentation.slides[0]

        # कॉलम चौड़ाई और पंक्ति ऊँचाई निर्धारित करें।
        widths = [80, 80]
        heights = [30, 30]

        # स्लाइड में एक टेबल शेप जोड़ें।
        table = slide.shapes.add_table(50, 50, widths, heights)

        presentation.save("table.pptx", slides.export.SaveFormat.PPTX)

तालिका तक पहुँचें

स्लाइड पर पहली तालिका shape प्राप्त करें।

def access_table():
    with slides.Presentation("table.pptx") as presentation:
        slide = presentation.slides[0]

        # स्लाइड पर पहली तालिका तक पहुँचें।
        first_table = next(shape for shape in slide.shapes if isinstance(shape, slides.Table))

तालिका हटाएँ

स्लाइड से एक तालिका हटाएँ।

def remove_table():
    with slides.Presentation("table.pptx") as presentation:
        slide = presentation.slides[0]

        # मान लें कि पहली shape एक तालिका है।
        table = slide.shapes[0]

        # स्लाइड से तालिका हटाएँ।
        slide.shapes.remove(table)

        presentation.save("table_removed.pptx", slides.export.SaveFormat.PPTX)

तालिका सेल्स को मर्ज करें

तालिका की सन्निहित सेल्स को एकल सेल में मर्ज करें।

def merge_table_cells():
    with slides.Presentation("table.pptx") as presentation:
        slide = presentation.slides[0]

        # मान लेते हैं कि पहली shape एक तालिका है।
        table = slide.shapes[0]

        # कोशिकाओं को मिलाएँ।
        table.merge_cells(table.rows[0][0], table.rows[1][1], False)

        presentation.save("cells_merged.pptx", slides.export.SaveFormat.PPTX)