Save

Save(string, int[], SaveFormat)

Saves specified slides of a presentation to a file with the specified format with page number keeping.

public void Save(string fname, int[] slides, SaveFormat format)
ParameterTypeDescription
fnameStringPath to the created file.
slidesInt32[]Array with slide positions, starting from 1.
formatSaveFormatFormat of the exported data.

Exceptions

exceptioncondition
ArgumentNullExceptionWhen stream or slides parameter is null.
ArgumentOutOfRangeExceptionWhen slides parameter contains wrong page numbers.
InvalidOperationExceptionWhen an unsupported SaveFormat is used, e.g. PPTX, PPTM, PPSX, PPSM, POTX, POTM, PPT, ODP.

See Also


Save(string, int[], SaveFormat, ISaveOptions)

Saves specified slides of a presentation to a file with the specified format with page number keeping.

public void Save(string fname, int[] slides, SaveFormat format, ISaveOptions options)
ParameterTypeDescription
fnameStringPath to the created file.
slidesInt32[]Array with slide positions, starting from 1.
formatSaveFormatFormat of the exported data.
optionsISaveOptionsAdditional format options.

See Also


Save(Stream, int[], SaveFormat)

Saves specified slides of a presentation to a stream in the specified format with page number keeping.

public void Save(Stream stream, int[] slides, SaveFormat format)
ParameterTypeDescription
streamStreamOutput stream.
slidesInt32[]Array with slide positions, starting from 1.
formatSaveFormatFormat of the exported data.

See Also


Save(Stream, int[], SaveFormat, ISaveOptions)

Saves specified slides of a presentation to a stream in the specified format with page number keeping.

public void Save(Stream stream, int[] slides, SaveFormat format, ISaveOptions options)
ParameterTypeDescription
streamStreamOutput stream.
slidesInt32[]Array with slide positions, starting from 1.
formatSaveFormatFormat of the exported data.
optionsISaveOptionsAdditional format options.

Exceptions

exceptioncondition
ArgumentNullExceptionWhen stream or slides parameter is null.
ArgumentOutOfRangeExceptionWhen slides parameter contains wrong page numbers.
InvalidOperationExceptionWhen an unsupported SaveFormat is used, e.g. PPTX, PPTM, PPSX, PPSM, POTX, POTM, PPT, ODP.

Examples

The following example shows how to convert PowerPoint to PNG.

[C#]
using (Presentation pres = new Presentation("pres.pptx"))
{
    for (var index = 0; index < pres.Slides.Count; index++)
    {
        ISlide slide = pres.Slides[index];
        slide.GetThumbnail().Save($"slide_{index}.png", ImageFormat.Png);
    }
}

The following example shows how to convert PowerPoint to PNG with custom dimensions.

[C#]
using (Presentation pres = new Presentation("pres.pptx"))
{
    float scaleX = 2f;
    float scaleY = 2f;
    for (var index = 0; index < pres.Slides.Count; index++)
    {
        ISlide slide = pres.Slides[index];
        slide.GetThumbnail(scaleX, scaleY).Save($"slide_{index}.png", ImageFormat.Png);
    }
}

The following example shows how to convert PowerPoint to PNG with custom size.

[C#]
using (Presentation pres = new Presentation("pres.pptx"))
{
    Size size = new Size(960, 720);
    for (var index = 0; index < pres.Slides.Count; index++)
    {
        ISlide slide = pres.Slides[index];
        slide.GetThumbnail(size).Save($"slide_{index}.png", ImageFormat.Png);
    }
}

See Also


Save(string, SaveFormat)

Saves all slides of a presentation to a file with the specified format.

public void Save(string fname, SaveFormat format)
ParameterTypeDescription
fnameStringPath to the created file.
formatSaveFormatFormat of the exported data.

See Also


Save(Stream, SaveFormat)

Saves all slides of a presentation to a stream in the specified format.

public void Save(Stream stream, SaveFormat format)
ParameterTypeDescription
streamStreamOutput stream.
formatSaveFormatFormat of the exported data.

See Also


Save(string, SaveFormat, ISaveOptions)

public void Save(string fname, SaveFormat format, ISaveOptions options)

See Also


Save(Stream, SaveFormat, ISaveOptions)

Saves all slides of a presentation to a stream in the specified format and with additional options.

public void Save(Stream stream, SaveFormat format, ISaveOptions options)
ParameterTypeDescription
streamStreamOutput stream.
formatSaveFormatFormat of the exported data.
optionsISaveOptionsAdditional format options.

Exceptions

exceptioncondition
NotSupportedExceptionIf you try to save encrypted file in none Office 2007-2010 format

See Also


Save(IXamlOptions)

Saves all slides of a presentation to a set of files representing XAML markup.

public void Save(IXamlOptions options)
ParameterTypeDescription
optionsIXamlOptionsThe XAML format options.

Examples

[C#]
using (Presentation pres = new Presentation("pres.pptx"))
{
	pres.Save(new XamlOptions { ExportHiddenSlides = true });
}

See Also