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 :
ExportOptions Dialog ClassName
C1D, C1DB, C1DX
Jpg, Png, Bmp, Tiff
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 :
- 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.
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
In Design mode set Localizable property of CustomPdfForm as true and set Language property to French (France).
- 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.
- Once you have completed designing the form in your language add the following code in Program.cs file in the main() method:
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
Thread.CurrentThread.CurrentUICulture= new System.Globalization.CultureInfo("fr-FR");
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";
Run the application.
You may use the same approach to customize these dialogs also. Download the attached sample for detailed implementation. Download Sample