Interface ISections
Namespace: Syncfusion.Presentation
Assembly: Syncfusion.Presentation.NET.dll
Syntax
public interface ISections : IEnumerable<ISection>, IEnumerable
Properties
Count
Returns the number of ISection instance in the section collection. Read-only.
Declaration
int Count { get; }
Property Value
Type |
---|
System.Int32 |
Examples
//Creates a PowerPoint presentation
IPresentation presentation = Presentation.Create();
//Adds a section to the PowerPoint presentation
ISection section = presentation.Sections.Add();
//Adds a slide to the created section
ISlide slide = section.AddSlide(SlideLayoutType.Blank);
//Adds a text box to the slide
slide.AddTextBox(10, 10, 100, 100).TextBody.AddParagraph("Slide in SectionDemo");
//Get the count of the section in a presentation
int count = presentation.Sections.Count;
//Saves the PowerPoint presentation
presentation.Save("Section.pptx");
'Creates a PowerPoint presentation
Dim presentation__1 As IPresentation = Presentation.Create()
'Adds a section to the PowerPoint presentation
Dim section As ISection = presentation__1.Sections.Add()
'Adds a slide to the created section
Dim slide As ISlide = section.AddSlide(SlideLayoutType.Blank)
'Get the count of the section in a presentation
int count = presentation.Sections.Count
'Adds a text box to the slide
slide.AddTextBox(10, 10, 100, 100).TextBody.AddParagraph("Slide in SectionDemo")
'Saves the PowerPoint presentation
presentation__1.Save("Section.pptx")
Item[Int32]
Gets the ISection instance at the specified index in section collection. Read-only.
Declaration
ISection this[int index] { get; }
Parameters
Type | Name | Description |
---|---|---|
System.Int32 | index | The index to locate the section. |
Property Value
Type | Description |
---|---|
ISection | Returns the section at the specified index in section collection. |
Examples
//Creates a PowerPoint presentation
IPresentation presentation = Presentation.Create();
//Adds a section to the PowerPoint presentation
ISection section1 = presentation.Sections.Add();
//Adds a section to the PowerPoint presentation
presentation.Sections.Add();
//Adds a slide to the created section
ISlide slide = section1.AddSlide(SlideLayoutType.Blank);
//Adds a text box to the slide
slide.AddTextBox(10, 10, 100, 100).TextBody.AddParagraph("Slide in SectionDemo");
//Get the section
ISection section2 = presentation.Sections[1];
//Saves the PowerPoint presentation
presentation.Save("Section.pptx");
'Creates a PowerPoint presentation
Dim presentation__1 As IPresentation = Presentation.Create()
'Adds a section to the PowerPoint presentation
Dim section1 As ISection = presentation__1.Sections.Add()
'Adds a section to the PowerPoint presentation
presentation__1.Sections.Add()
'Adds a slide to the created section
Dim slide As ISlide = section.AddSlide(SlideLayoutType.Blank)
'Get the section
Dim section2 As ISection = presentation.Sections(1)
'Adds a text box to the slide
slide.AddTextBox(10, 10, 100, 100).TextBody.AddParagraph("Slide in SectionDemo")
'Saves the PowerPoint presentation
presentation__1.Save("Section.pptx")
Methods
Add()
Adds a new section at the last index position and returns the instance of the newly created section.
Declaration
ISection Add()
Returns
Type | Description |
---|---|
ISection | Returns the ISection instance. |
Examples
//Creates a PowerPoint presentation
IPresentation presentation = Presentation.Create();
//Adds a section to the PowerPoint presentation
ISection section = presentation.Sections.Add();
//Sets a name to the created section
section.Name = "SectionDemo";
//Adds a slide to the created section
ISlide slide = section.AddSlide(SlideLayoutType.Blank);
//Adds a text box to the slide
slide.AddTextBox(10, 10, 100, 100).TextBody.AddParagraph("Slide in SectionDemo");
//Saves the PowerPoint presentation
presentation.Save("Section.pptx");
'Creates a PowerPoint presentation
Dim presentation__1 As IPresentation = Presentation.Create()
'Adds a section to the PowerPoint presentation
Dim section As ISection = presentation__1.Sections.Add()
'Sets a name to the created section
section.Name = "SectionDemo"
'Adds a slide to the created section
Dim slide As ISlide = section.AddSlide(SlideLayoutType.Blank)
'Adds a text box to the slide
slide.AddTextBox(10, 10, 100, 100).TextBody.AddParagraph("Slide in SectionDemo")
'Saves the PowerPoint presentation
presentation__1.Save("Section.pptx")
Clear()
Removes all the sections in the presentation.
Declaration
void Clear()
Examples
//Creates a PowerPoint presentation
IPresentation presentation = Presentation.Create();
//Adds a section to the PowerPoint presentation
ISection section = presentation.Sections.Add();
//Adds a slide to the created section
ISlide slide = section.AddSlide(SlideLayoutType.Blank);
//Adds a text box to the slide
slide.AddTextBox(10, 10, 100, 100).TextBody.AddParagraph("Slide in SectionDemo");
//Removes the sections
presentation.Sections.Clear();
//Saves the PowerPoint presentation
presentation.Save("Section.pptx");
'Creates a PowerPoint presentation
Dim presentation__1 As IPresentation = Presentation.Create()
'Adds a section to the PowerPoint presentation
Dim section As ISection = presentation__1.Sections.Add()
'Adds a slide to the created section
Dim slide As ISlide = section.AddSlide(SlideLayoutType.Blank)
'Removes the sections
presentation.Sections.Clear()
'Adds a text box to the slide
slide.AddTextBox(10, 10, 100, 100).TextBody.AddParagraph("Slide in SectionDemo")
'Saves the PowerPoint presentation
presentation__1.Save("Section.pptx")
Insert(Int32, ISection)
Inserts an element into the section collection at the specified index.
Declaration
void Insert(int index, ISection section)
Parameters
Type | Name | Description |
---|---|---|
System.Int32 | index | The zero-based index at which section should be inserted. |
ISection | section | The section instance to insert. |
Examples
//Creates a PowerPoint presentation
IPresentation presentation = Presentation.Create();
//Adds a section to the PowerPoint presentation
ISection section1 = presentation.Sections.Add();
//Adds a section to the PowerPoint presentation
ISection section2 = presentation.Sections.Add();
//Adds a slide to the created section
ISlide slide = section1.AddSlide(SlideLayoutType.Blank);
//Adds a text box to the slide
slide.AddTextBox(10, 10, 100, 100).TextBody.AddParagraph("Slide in SectionDemo");
//Insert a section at the specified index.
presentation.Sections.Insert(0,section2);
//Saves the PowerPoint presentation
presentation.Save("Section.pptx");
'Creates a PowerPoint presentation
Dim presentation__1 As IPresentation = Presentation.Create()
'Adds a section to the PowerPoint presentation
Dim section1 As ISection = presentation__1.Sections.Add()
'Adds a section to the PowerPoint presentation
Dim section2 As ISection = presentation__1.Sections.Add()
'Adds a slide to the created section
Dim slide As ISlide = section.AddSlide(SlideLayoutType.Blank)
'Insert a section at the specified index
presentation.Sections.Insert(0,section2)
'Adds a text box to the slide
slide.AddTextBox(10, 10, 100, 100).TextBody.AddParagraph("Slide in SectionDemo")
'Saves the PowerPoint presentation
presentation__1.Save("Section.pptx")
Remove(ISection)
Removes the first occurrence of a specified section from the section collection.
Declaration
void Remove(ISection section)
Parameters
Type | Name | Description |
---|---|---|
ISection | section | Represent the ISection instance to be removed. |
Examples
//Creates a PowerPoint presentation
IPresentation presentation = Presentation.Create();
//Adds a section to the PowerPoint presentation
ISection section1 = presentation.Sections.Add();
//Adds a section to the PowerPoint presentation
ISection section2 = presentation.Sections.Add();
//Adds a slide to the created section
ISlide slide = section1.AddSlide(SlideLayoutType.Blank);
//Adds a text box to the slide
slide.AddTextBox(10, 10, 100, 100).TextBody.AddParagraph("Slide in SectionDemo");
//Remove the section.
presentation.Sections.Remove(section2);
//Saves the PowerPoint presentation
presentation.Save("Section.pptx");
'Creates a PowerPoint presentation
Dim presentation__1 As IPresentation = Presentation.Create()
'Adds a section to the PowerPoint presentation
Dim section1 As ISection = presentation__1.Sections.Add()
'Adds a section to the PowerPoint presentation
Dim section2 As ISection = presentation__1.Sections.Add()
'Adds a slide to the created section
Dim slide As ISlide = section.AddSlide(SlideLayoutType.Blank)
'Remove the section
presentation.Sections.Remove(section2)
'Adds a text box to the slide
slide.AddTextBox(10, 10, 100, 100).TextBody.AddParagraph("Slide in SectionDemo")
'Saves the PowerPoint presentation
presentation__1.Save("Section.pptx")
RemoveAt(Int32)
Removes the section at the specified index, from the section collection.
Declaration
void RemoveAt(int index)
Parameters
Type | Name | Description |
---|---|---|
System.Int32 | index | Represents the index at which the section is to be removed. |
Examples
//Creates a PowerPoint presentation
IPresentation presentation = Presentation.Create();
//Adds a section to the PowerPoint presentation
ISection section1 = presentation.Sections.Add();
//Adds a section to the PowerPoint presentation
ISection section2 = presentation.Sections.Add();
//Adds a slide to the created section
ISlide slide = section1.AddSlide(SlideLayoutType.Blank);
//Adds a text box to the slide
slide.AddTextBox(10, 10, 100, 100).TextBody.AddParagraph("Slide in SectionDemo");
//Remove the section at the specified index.
presentation.Sections.RemoveAt(1);
//Saves the PowerPoint presentation
presentation.Save("Section.pptx");
'Creates a PowerPoint presentation
Dim presentation__1 As IPresentation = Presentation.Create()
'Adds a section to the PowerPoint presentation
Dim section1 As ISection = presentation__1.Sections.Add()
'Adds a section to the PowerPoint presentation
Dim section2 As ISection = presentation__1.Sections.Add()
'Adds a slide to the created section
Dim slide As ISlide = section.AddSlide(SlideLayoutType.Blank)
'Remove the section at the specified index
presentation.Sections.RemoveAt(1)
'Adds a text box to the slide
slide.AddTextBox(10, 10, 100, 100).TextBody.AddParagraph("Slide in SectionDemo")
'Saves the PowerPoint presentation
presentation__1.Save("Section.pptx")