# Customizing the Print Preview Dialog

Learn how to customize the Print Preview Dialog like Excel using the EnhancePreview property of the PrintInfo class in Spread.NET.

## Content

You can customize the Print Preview settings to show the **Print Preview Dialog** like Excel by using the [EnhancePreview](/spreadnet/api/latest/online-win/FarPoint.Win.Spread/FarPoint.Win.Spread.PrintInfo.EnhancePreview.html) property of the [PrintInfo](/spreadnet/api/latest/online-win/FarPoint.Win.Spread/FarPoint.Win.Spread.PrintInfo.html) class.
The following image shows the printing options that appear on your screen after setting the EnhancePreview property to true.
![Print Preview dialog displaying various printing operations](https://cdn.mescius.io/document-site-files/images/2238e618-a1fb-45a6-9ce5-9a4157bd2931/images/show-print_preview_dialog.png)
**Using Code**
Set the [EnhancePreview](/spreadnet/api/latest/online-win/FarPoint.Win.Spread/FarPoint.Win.Spread.PrintInfo.EnhancePreview.html) property of the [PrintInfo](/spreadnet/api/latest/online-win/FarPoint.Win.Spread/FarPoint.Win.Spread.PrintInfo.html) class to true in order to customize the print preview setting to show the Print Preview Dialog like Excel.
This example shows how to set the [EnhancePreview](/spreadnet/api/latest/online-win/FarPoint.Win.Spread/FarPoint.Win.Spread.PrintInfo.EnhancePreview.html) property.

```csharp
//Code to show print preview dialog like Excel

fpSpread1.ActiveSheet.Cells[1, 1].Value = "1,1";
fpSpread1.ActiveSheet.Cells[10, 10].Value = "10,10";
fpSpread1.ActiveSheet.PrintInfo.EnhancePreview = true;
fpSpread1.PrintSheet(fpSpread1.ActiveSheet);
```

```vbnet
'Code to show print preview dialog like Excel
fpSpread1.ActiveSheet.Cells(1, 1).Value = "1,1"
fpSpread1.ActiveSheet.Cells(10, 10).Value = "10,10"
fpSpread1.ActiveSheet.PrintInfo.EnhancePreview = True
fpSpread1.PrintSheet(fpSpread1.ActiveSheet)
```

## Localizing the Print Preview Dialog

Spread for WinForms allows you to customize and localize the text displayed in **EnhancedPrintPreview** and **PageSetup** dialog in your preferred language. To localize these dialogs, use the [FarPoint.Win.Localizer.LocalizeText](/spreadnet/api/latest/online-win/FarPoint.Win/FarPoint.Win.Localizer.LocalizeText.html) event, which manages the retrieval of localized strings from a resource file. The localization of these dialogs works only when the [ExcelCompatiblePrinting ](/spreadnet/api/latest/online-win/FarPoint.Win.Spread/FarPoint.Win.Spread.IFeatures.ExcelCompatiblePrinting.html)is true.
The localization of strings in dialogs is based on the same approach as the standard localization of .NET Winforms, which uses the resource files (.resx) to store translations.
You need to create separate resource files for each language, which allows you to switch between localized resources at runtime. It is important to ensure that all parts of the application using a particular DLL (assembly) must share the same localization resource, as it creates inconsistency if different resources are used.
The following code is used to localize the EnhancedPrintPreview and the PageSetup dialogs.

```csharp
//Event that manages the retrieval of translated strings
FarPoint.Win.Localizer localizer = FarPoint.Win.Localizer.Instance;
localizer.LocalizeText += Localizer_LocalizeText;

//EnhancedPrintPreview is the name of namespace and enhancedprintpreview is the name of .resx file
enhancePrintPreviewResx = new ResourceManager("EnhancedPrintPreview.Resources.enhancedprintpreview", typeof(Resources.enhancedprintpreview).Assembly);

pageSetupResx = new ResourceManager("PrintPreview.Resources.pagesetup", typeof(Resource.pagesetup).Assembly);

  private void Localizer_LocalizeText(object sender, LocalizedTextEventArgs e)
  {
      string text = null;
      if (sender is Form)
      {
          string senderName = ((Form)sender).Name;
          switch (senderName)
          {
              case "EnhancedPrintPreviewDialog":
                  {
                      text = enhancePrintPreviewResx.GetString(e.Key);
                      break;
                  }
              case "PageSetup":
                  {
                      text = pageSetupResx.GetString(e.Key);
                      break;
                  }
          }
      }
      if (text != null)
          e.Text = text;
  }
```

```vbnet
'Event that manages the retrieval of translated strings
 Dim localizer As FarPoint.Win.Localizer = FarPoint.Win.Localizer.Instance
 AddHandler localizer.LocalizeText, AddressOf Localizer_LocalizeText

'EnhancedPrintPreview is the name of namespace and enhancedprintpreview is the name of .resx file

 enhancePrintPreviewResx = New ResourceManager("EnhancedPrintPreview.Resources.enhancedprintpreview", GetType(Resources.enhancedprintpreview).Assembly)

pageSetupResx = New ResourceManager("PageSetup.Resources.pagesetup", GetType(Resources.pagesetup).Assembly)

 Private Sub Localizer_LocalizeText(sender As Object, e As FarPoint.Win.LocalizedTextEventArgs)
     Dim text As String = Nothing
     If TypeOf sender Is Form Then
         Dim senderName As String = DirectCast(sender, Form).Name
         Select Case senderName
             Case "EnhancedPrintPreviewDialog"
                 text = enhancePrintPreviewResx.GetString(e.Key)
             Case "PageSetup"
                 text = pageSetupResx.GetString(e.Key)
         End Select
     End If
     If text IsNot Nothing Then
         e.Text = text
     End If
 End Sub
```

The image below depicts the localized text of EnhancedPrintPreview and PageSetup dialogs as per the translated Japanese language strings stored in resource files.

| **Localized Image for EnhancedPrintPreview Dialog** | **Localized Image for PageSetup Dialog** |
| ----------------------------------------------- | ------------------------------------ |
| ![localisedprintpreview](https://cdn.mescius.io/document-site-files/images/54abcb20-afcc-431e-ae8b-c15c7e64f8e9/localisedprintpreview.89b9d9.png) | ![Pagesetuplocalised](https://cdn.mescius.io/document-site-files/images/54abcb20-afcc-431e-ae8b-c15c7e64f8e9/Pagesetuplocalised.323b1a.png) |

## See Also

[Understanding the Printing Options](/spreadnet/docs/latest/online-win/overview/spwin-devguide/spwin-printing/spwin-printcustomize/spwin-printoptions)
[Customizing the Print Job Settings](/spreadnet/docs/latest/online-win/overview/spwin-devguide/spwin-printing/spwin-printcustomize/spwin-printsettings)
[Customizing the Printed Page Layout](/spreadnet/docs/latest/online-win/overview/spwin-devguide/spwin-printing/spwin-printcustomize/spwin-printlayout)
[Customizing the Printed Page Header or Footer](/spreadnet/docs/latest/online-win/overview/spwin-devguide/spwin-printing/spwin-printcustomize/spwin-printheadfoot)
[Repeating Rows or Columns on Printed Pages](/spreadnet/docs/latest/online-win/overview/spwin-devguide/spwin-printing/spwin-printcustomize/spwin-printrepeatrange)
[Adding a Page Break](/spreadnet/docs/latest/online-win/overview/spwin-devguide/spwin-printing/spwin-printcustomize/spwin-pagebreaks)
[Adding a Watermark to a Printed Page](/spreadnet/docs/latest/online-win/overview/spwin-devguide/spwin-printing/spwin-printcustomize/spwin-printwatermark)