officefileapi-devexpress-dot-spreadsheet-dot-formatting-ec6f673b.md
Locks the Formatting object. Prevents visual updates until the EndUpdate method calls.
Namespace : DevExpress.Spreadsheet
Assembly : DevExpress.Spreadsheet.v25.2.Core.dll
NuGet Package : DevExpress.Spreadsheet.Core
void BeginUpdate()
Sub BeginUpdate
Use the BeginUpdate and EndUpdate methods to avoid flickering during batch modifications to the Formatting‘s settings. After calling BeginUpdate, any changes to the Formatting‘s settings do not cause immediate repainting. This allows multiple changes without affecting performance or causing screen flickering. Once you finish all desired changes, call EndUpdate.
The BeginUpdate and EndUpdate methods use an internal counter to manage updates. The counter starts at 0. When the counter is above 0, the system blocks visual updates. When the counter returns to 0, the system allows updates. The BeginUpdate method increments the counter. The EndUpdate method decrements the counter. If the counter reaches 0, an immediate visual update occurs.
Always pair each BeginUpdate call with an EndUpdate call. To ensure EndUpdate runs even if an exception occurs, use the try...finally statement.
Use a style‘s index or name to obtain it from the Workbook.Styles collection.
To change the style’s format attributes, modify the Style object’s properties within the Formatting.BeginUpdate - Formatting.EndUpdate method calls.
// Access a style you want to modify.
Style customStyle = workbook.Styles["Custom Style"];
// Change the style's format characteristics.
customStyle.BeginUpdate();
try {
customStyle.Fill.BackgroundColor = Color.Gold;
// ...
} finally {
customStyle.EndUpdate();
}
' Access a style you want to modify.
Dim customStyle As Style = workbook.Styles("Custom Style")
' Change the style's format characteristics.
customStyle.BeginUpdate()
Try
customStyle.Fill.BackgroundColor = Color.Gold
' ...
Finally
customStyle.EndUpdate()
End Try
The following code snippet (auto-collected from DevExpress Examples) contains a reference to the BeginUpdate() method.
Note
The algorithm used to collect these code examples remains a work in progress. Accordingly, the links and snippets below may produce inaccurate results. If you encounter an issue with code examples below, please use the feedback form on this page to report the issue.
' Specify formatting characteristics for the style.
myStyle.BeginUpdate()
Try
See Also