Aspose.Cell Hide Column Header

Hello Team,

We are doing Image export for each worksheet as one page , here we want to provide an option to hide column header.

we tried by setting IsRowColumnHeadersVisible = false. but it still shows the header in exported TIF file.

can you guide us is this correct way to hide to column header ?

Thanks

@Viral84

How to hide the row‑ and column‑headings when exporting a worksheet to a TIF image with Aspose.Cells

Worksheet.PageSetup.IsRowColumnHeadersVisible only affects Excel’s print‑preview UI.
The image renderer uses its own option – ImageOrPdfSaveOptions.IsRowColumnHeadersVisible.
Set this flag (and, if you like, clear the page‑setup PrintHeadings flag) before calling Workbook.Save.


Minimal C# example

using Aspose.Cells;
using Aspose.Cells.Rendering;   // ImageOrPdfSaveOptions lives here

// 1. Load the workbook
Workbook wb = new Workbook(@"C:\Input\Sample.xlsx");

// 2. Configure the image‑export options
ImageOrPdfSaveOptions imgOpts = new ImageOrPdfSaveOptions(SaveFormat.Tiff)
{
    // Export each worksheet as a single page (optional)
    IsOnePagePerSheet = true,

    // Hide the row/column headings in the exported image
    IsRowColumnHeadersVisible = false,

    // Optional – keep the workbook “clean” for other exports
    // (does not affect the image when the renderer flag is set)
    // wb.Worksheets[0].PageSetup.PrintHeadings = false;
};

// 3. Save the workbook as a TIF image
wb.Save(@"C:\Output\Sheet1.tif", imgOpts);

When the workbook contains several worksheets

The same ImageOrPdfSaveOptions instance can be reused for all sheets:

foreach (Worksheet ws in wb.Worksheets)
{
    ws.PageSetup.PrintHeadings = false;   // optional, for consistency
}
wb.Save(@"C:\Output\AllSheets.tif", imgOpts);

Key points

What you tried Why it didn’t work Correct approach
worksheet.PageSetup.IsRowColumnHeadersVisible = false; This flag is consulted only by Excel’s UI/print‑preview, not by the image renderer. Set ImageOrPdfSaveOptions.IsRowColumnHeadersVisible = false.
worksheet.PageSetup.PrintHeadings = false; (optional) Influences printing but not image rendering unless the renderer looks at the page‑setup flag. Keep it if you also export to PDF/print, but the renderer flag is the decisive one for images.

Summary

  • Do not rely on Worksheet.PageSetup.IsRowColumnHeadersVisible for image export.
  • Use ImageOrPdfSaveOptions.IsRowColumnHeadersVisible = false (the renderer‑level option).
  • Optionally set Worksheet.PageSetup.PrintHeadings = false for consistency with other export formats.

With these settings the generated TIF (or PNG, JPEG, PDF, etc.) will contain the worksheet data without the row and column headings.

Hello Team,

Thanks for the update, but here one concern, I am using aspose.cell version 25.10.0

I am already setting below options for Image
var imgOptions = new ImageOrPrintOptions
{
ImageType = Aspose.Cells.Drawing.ImageType.Tiff,
OnePagePerSheet = true,
PrintingPage = PrintingPageType.Default,
HorizontalResolution = 300,
VerticalResolution = 300,
OutputBlankPageWhenNothingToPrint = false

};

but did find any property like IsRowColumnHeadersVisible in this options to set.
can you suggest, if anything going wrong at my end ?

Thanks

@Viral84
Please try the following sample code:

Workbook book = new Workbook(filePath + "sample.xlsx");

var imgOptions = new ImageOrPrintOptions
{
    ImageType = Aspose.Cells.Drawing.ImageType.Tiff,
    OnePagePerSheet = true,
    PrintingPage = PrintingPageType.Default,
    HorizontalResolution = 300,
    VerticalResolution = 300,
    OutputBlankPageWhenNothingToPrint = false

};

foreach (Worksheet ws in book.Worksheets)
{
    ws.PageSetup.PrintHeadings = false;

    SheetRender render = new SheetRender(ws, imgOptions);

    render.ToImage(0, filePath + ws.Name + ".tiff");
}

If you still have issues, please provide sample files and complete runnable test code, and we will check it soon.

Hello Team,

find this attached sample file.
6615_NEW.zip (5.1 KB)

below is full code,
public static void ExportExcelwithNoHeader()
{
string filePath = @“W:\AsposelibTesting\Excel files\6615_NEW.xls”;

        Workbook book = new Workbook(filePath);

        var imgOptions = new ImageOrPrintOptions
        {
            ImageType = Aspose.Cells.Drawing.ImageType.Tiff,
            OnePagePerSheet = true,
            PrintingPage = PrintingPageType.Default,
            HorizontalResolution = 300,
            VerticalResolution = 300,
            OutputBlankPageWhenNothingToPrint = false

        };

        foreach (Worksheet ws in book.Worksheets)
        {
            ws.PageSetup.PrintHeadings = false;

            SheetRender render = new SheetRender(ws, imgOptions);

            for (int pageIndex = 0; pageIndex < render.PageCount; pageIndex++)
            {
                string fileName = Path.Combine("D:\\",
                    $"{Path.GetFileNameWithoutExtension(filePath)}_{ws.Name}_Page{pageIndex + 1}.{imgOptions.ImageType.ToString().ToLower()}");

                // Ensure overwriting old images
                if (File.Exists(fileName))
                    File.Delete(fileName);

                render.ToImage(pageIndex, fileName);
            }

        }
    }

In output it don’t hide any column header part.

Thanks

@Viral84
This is our test result. It can be observed that the headings of rows and columns (A, B, C… and 1,2,3…) have not been exported. Please refer to the attachment. tiff.zip (165.2 KB)

Is your goal to avoid exporting the first row of data from the worksheet? If so, please hide the first row before exporting. Please add the following sample code. Please check the attachment. tiff_hidden.zip (134.7 KB)

ws.Cells.Rows[0].IsHidden = true;

If you still have questions, please provide your expected results. We will check it soon.

@Viral84
Of course, you can also specify the printing area of the worksheet to filter data more flexibly. Please refer to the following example code and check the attachment. tiff_area.zip (139.2 KB)

Workbook book = new Workbook(filePath + "6615_NEW.xls");

var imgOptions = new ImageOrPrintOptions
{
    ImageType = Aspose.Cells.Drawing.ImageType.Tiff,
    OnePagePerSheet = true,
    PrintingPage = PrintingPageType.Default,
    HorizontalResolution = 300,
    VerticalResolution = 300,
    OutputBlankPageWhenNothingToPrint = false,
    OnlyArea = true

};

foreach (Worksheet ws in book.Worksheets)
{
    int maxDataRow = ws.Cells.MaxDataRow;
    int maxDataColumn = ws.Cells.MaxDataColumn;
    if (maxDataRow < 0 || maxDataColumn < 0)
    {
        continue;
    }
    string area = CellsHelper.CellIndexToName(1, 0)  + ":" + CellsHelper.CellIndexToName(maxDataRow, maxDataColumn);
    ws.PageSetup.PrintArea = area;

    ws.PageSetup.PrintHeadings = false;

    SheetRender render = new SheetRender(ws, imgOptions);

    for (int pageIndex = 0; pageIndex < render.PageCount; pageIndex++)
    {
        string fileName = filePath + ws.Name + "_area.tiff";

        // Ensure overwriting old images
        if (File.Exists(fileName))
            File.Delete(fileName);

        render.ToImage(pageIndex, fileName);
    }

}

Hello @John.He ,

Its my misunderstanding for provided option, I was thinking this is an option to hide Column Header of written data and print only rows.

but as per your suggestion I got the fix.

Thanks

@Viral84
Thank you for your feedback. I’m glad you found a solution through the previous suggestions. If you have any questions, please feel free to contact us at any time.

@Viral84,

Please note, the property Worksheet.IsRowColumnHeadersVisible | Aspose.Cells for .NET API Reference is used to set whether the worksheet will display row and column headers when viewing the output Excel file (e.g., XLSX) into MS Excel manually. It does not do anything when rendering the data range to image format.

Hi,

So just to confirm if there are multiple tables then there is no direct option to set ColumnHeader visiblity,right ? here column is refer to actual data column not ABC columns.

and will there any option to show or hide Top Header part heading text in export Image ?

Thanks

@Viral84
We can not simply detect which row is column header row of the table as they are normal data of the worksheet. So please find a way to check which row is column header according your business by yourself, then hide row with Cells.HideRow() method.
We supported search data as Find or Search Data|Documentation
or iterate all cells as How and Where to Use Enumerators|Documentation

Thanks for Information

@Viral84
You are welcome. If you have any questions, please feel free to contact us at any time.