Customizing the File Formats in the Save As Dialog Box
To customize the file formats in the Save As dialog box to only save files in a particular file format (for example, Adobe PDF), all of the other file formats except for PDF must be disabled using the ExportOptions property.
To save to a file format other than Adobe PDF (.pdf), replace the "PdfExportProvider" text in the following code to one of the following options:
File Format |
Export Provider |
BMP Image (.bmp) |
BmpExportProvider |
C1 Document (.c1d) |
C1dExportProvider |
Enhanced Metafile (.emf) |
EmfExportProvider |
GIF Image (.gif) |
GifExportProvider |
HTML (.htm) |
HtmlExportProvider |
JPEG Image (.jpg) |
JpegExportProvider |
Microsoft Excel (.xls) |
XlsExportProvider |
Open XML MS Excel File (.xlsx) |
XslsExportProvider |
PNG Image (.png) |
PngExportProvider |
Rich Text Format (.rtf) |
RtfExportProvider |
TIFF Image (.tiff) |
TiffExportProvider |
Add the following code to the Form_Load event:
Dim lp As Integer = 0
While lp < Me.C1PrintPreviewControl1.ExportOptions.Count
If Not TypeOf (C1PrintPreviewControl1.ExportOptions(lp).ExportProvider) Is C1.C1Preview.Export.PdfExportProvider Then
C1PrintPreviewControl1.ExportOptions(lp).Enabled = False
End If
lp = lp + 1
End While
• C#
for (int lp = 0; lp < c1PrintPreviewControl1.ExportOptions.Count; lp++)
{
if (!(c1PrintPreviewControl1.ExportOptions[lp].ExportProvider is C1.C1Preview.Export.PdfExportProvider))
{
c1PrintPreviewControl1.ExportOptions[lp].Enabled = false;
}
}
What You've Accomplished
The only available file format in the Save As dialog box is Adobe PDF:
|