Skip to main content Skip to footer

Localization of ExportOptions Dialog in C1Reports

The C1Reports provide support for creating localized versions of all end-user visible strings for different cultures at design time and switch between languages at run time. To localize Reports for WinForms components in your application, refer to Report Documentation. However, this localize dialog does not provide options to localize the ExportOptions when the print document is exported. This blog discusses the approach to localize the ExportOptions Dialogs used in C1Print Preview Control exporting. You can use the similar approach if you want to customize these dialogs.

About ExportOptions Dialogs

The C1PrintPreview controls provides exporting of C1PrintDocument in different formats. The ExportOptionsDialog classes are available in C1.C1Preview.Export namespace. Following table gives the class name of the ExportOptions dialog used :

Export Format

ExportOptions Dialog ClassName

C1D, C1DB, C1DX

C1DOptionsForm

Docx

DocxOptionsForm

Emf

EmfOptionsForm

Html

HtmlOptionsForm

Pdf

PdfOptionsForm

Rtf

RtfOptionsForm

Xls

XlsOptionsForm

Xlsx

XlsxOptionsForm

Jpg, Png, Bmp, Tiff

ImagesOptionsForm

Localization Of ExportOptions Dialogs

In this blog, we will explain the SaveOptions (PDF) form to French (France). Following steps are used to localize the dialog :

  1. Create a new Form by Right Clicking on Solution in Project Explorer-> Add -> Windows Form and name it anything like I have named it CustomPdfForm.cs.
  2. Open the code for CustomPdfForm and modify CustomPdfForm class to derive from C1.C1Preview.Export.PdfOptionsForm than "Form" as follows:

    public partial class CustomPdfForm : C1.C1Preview.Export.PdfOptionsForm
    
  3. In Design mode set Localizable property of CustomPdfForm as true and set Language property to French (France).

  4. Now change the text of various Labels like "Use Compression" checkbox and change its Text property to "Use COMPRESSION" and so on for all controls.
  5. Once you have completed designing the form in your language add the following code in Program.cs file in the main() method:
    Thread.CurrentThread.CurrentUICulture= new System.Globalization.CultureInfo("fr-FR");
    
    P.S. : Here argument provided to CultureInfo is specific to French(France) Language. Please change if it has to be set for a different language
  6. In your main form where you are using the C1PrintPreviewControl, write the following code :

    ExporterOptions eo = c1PrintPreviewControl1.PreviewPane.ExportOptions[typeof(C1.C1Preview.Export.PdfExportProvider)];  
    eo.OptionsDialogClassName = "Sample_LocalizePrnPreview.CustomPdfForm";
    
  7. Run the application.

You may use the same approach to customize these dialogs also. Download the attached sample for detailed implementation. Download Sample

MESCIUS inc.

comments powered by Disqus