PNG JPG BMP TIFF XLSB
Aspose.Cells  for .NET

Redact XLSB Formats in C#

Native and high performance XLSB document sensitive redaction information using server-side Aspose.Cells for .NET APIs, without the use of any software like Microsoft or Adobe PDF.

How to Redact XLSB File Using C#

In order to redact XLSB file, we’ll use Aspose.Cells for .NET API which is a feature-rich, powerful and easy to use document manipulation API for C# platform. Open NuGet package manager, search for Aspose.Cells and install. You may also use the following command from the Package Manager Console.

Command


PM> Install-Package Aspose.Cells

Steps to Redact XLSB Files in C#

A basic document search and replace text in contents, comments or metadata with Aspose.Cells for .NET APIs can be done with just few lines of code.

  • Load XLSB file.
  • Select the sheet.
  • Create FindOptions object.
  • Set Search Options
  • Loop through each cell and use Find method.
  • Save the workbook.

System Requirements

Our APIs are supported on all major platforms and Operating Systems. Before executing the code below, please make sure that you have the following prerequisites on your system.

  • Microsoft Windows or a compatible OS with .NET Framework, .NET Core, Mono or Xamarin Platforms
  • Development environment like Microsoft Visual Studio
  • Add reference to the Aspose.Cells for .NET DLL in your project - Install from NuGet using the Download button above
 

Redact XLSB Files - C#

Workbook wb = new Workbook("e:\test2\Input.xlsb");
Worksheet sheet = wb.Worksheets[0];
FindOptions opts = new FindOptions();
opts.LookInType = LookInType.Values;
opts.LookAtType = LookAtType.Contains;
opts.RegexKey = true;
Aspose.Cells.Cell cell = null;
do
{   //find only whole word and not part of any word.  
    cell = sheet.Cells.Find("\bKIM\b", cell, opts);
    if (cell != null)
    {
        string celltext = cell.Value.ToString();
        celltext = celltext.Replace("KIM", "^^^^^^^^^^");
        cell.PutValue(celltext);
    }
}
while (cell != null);

wb.Save("e:\test2\out1.xlsb");

// Find/Replace in whole workbook.

Workbook wb = new Workbook("e:\test2\Input.xlsb");
wb.Replace("\bKIM\b", "^^^^^^^^", new ReplaceOptions() { RegexKey = true });  
wb.Save("e:\test2\output.xlsb");
 
  • About Aspose.Cells for .NET API

    Aspose.Cells API can be used to create, edit, convert and render Microsoft Excel formats to different formats. Moreover, it can be used for comprehensive charting, scalable reporting and reliable calculations within software applications. Aspose.Cells is a standalone API and it does not require any software like Microsoft or OpenOffice.

    Online XLSB Redaction Live Demos

    Other Supported Redaction Formats

    Using C#, one can easily redact different formats including.

    ODS (OpenDocument Spreadsheet File)
    XLS (Excel Binary Format)
    XLSM (Spreadsheet File)
    XLSX (OOXML Excel File)