Using Format Painter

Using Format Painter

The feature of Format Painter requires users to select a cell whose formatting settings you want to apply on other cells and then call StartFormatPainter method GridDesktop. There are two modes of format painter as follows:

  • Using Format Painter Once
  • Using Format Painter Always

Using Format Painter Once

If developers want to use the feature of format painter for just one time only to apply the formatting settings of a focused cell to a single cell then they can do it by calling StartFormatPainter method and passing a false value to it. This false value will prohibit format painter from painting forever.

// For complete examples and data files, please go to https://github.com/aspose-cells/Aspose.Cells-for-.NET
// Starting format painter to paint once
gridDesktop1.StartFormatPainter(false);

Using Format Painter Always

To use format painter always is a useful feature when we need to apply the formatting settings on more than one cells. Developers can achieve this feature by simply calling StartFormatPainter method and passing a true value to it.

// For complete examples and data files, please go to https://github.com/aspose-cells/Aspose.Cells-for-.NET
// Starting format painter to keep painting forever
gridDesktop1.StartFormatPainter(true);

This kind of format painter keeps painting forever unless we stop it. So, to stop format painter from painting always, we can simply call EndFormatPainter method of GridDesktop.

// For complete examples and data files, please go to https://github.com/aspose-cells/Aspose.Cells-for-.NET
// Ending format painter to stop painting
gridDesktop1.EndFormatPainter();