Regarding cell content shrunk

I have some data in a cell, but while viewing the document in the viewer, the content appears to be shrunk. Could you please suggest a solution? Please find the attached images.

Excel sheet in Microsoft excel.

image.png (7.0 KB)

My application :slight_smile:

image.png (13.7 KB)

@sarathepiq

Summary
The text appears “shrunken” only when the workbook is rendered with the Aspose .Cells viewer because the cells have the Shrink‑to‑Fit style enabled (or the column width is too narrow). The viewer respects this flag and reduces the font size so the content fits the cell.

Why it happens

  • In the original Excel file the cell style may have ShrinkToFit = true.
  • When Aspose .Cells renders the workbook (HTML, PDF, or the built‑in viewer) it follows the same style. If the column is narrower than the text, the renderer automatically shrinks the font, giving the impression that the whole sheet is “small”.

What to do next

  1. Disable Shrink‑to‑Fit for the cells that are affected (you can apply it to a single cell, a range, or the entire sheet).
// Load the workbook
var wb = new Aspose.Cells.Workbook("input.xlsx");
var ws = wb.Worksheets[0];

// Get an existing style (or create a new one)
var style = ws.Cells["A1"].GetStyle();
style.ShrinkToFit = false; // turn off shrinking

// Apply the style to the desired range – here the whole sheet
var range = ws.Cells.CreateRange(
0, ws.Cells.MaxDataRow + 1,
0, ws.Cells.MaxDataColumn + 1);
range.ApplyStyle(style, new Aspose.Cells.StyleFlag { ShrinkToFit = true });
  1. Adjust column widths (optional) if the text still overflows after disabling Shrink‑to‑Fit.
ws.Cells.SetColumnWidth(0, 20); // column A width = 20 characters
// repeat for other columns as needed
  1. Auto‑fit columns to let Aspose .Cells calculate optimal widths automatically.
ws.AutoFitColumns();
  1. Save or render the workbook using the same format you normally use (HTML, PDF, etc.). The viewer will now display the text at its original size.
var htmlOptions = new Aspose.Cells.HtmlSaveOptions
{
// default scaling (1.0) – no additional scaling required
};
wb.Save("output.html", htmlOptions);
  1. Verify the result by opening the generated file or the web viewer. The cells should no longer appear shrunken.

Additional quick fixes (optional)

  • Only a few cells are affected – apply the style to that specific range, e.g. ws.Cells["B2:D5"].SetStyle(style);.
  • The whole sheet looks shrunken – apply the style to the entire sheet as shown in step 1 and then call ws.AutoFitColumns();.
  • Viewer scaling – ensure that HtmlSaveOptions.Scale (or PdfSaveOptions.Scale) remains at the default value 1.0; a lower scale can also make the output look smaller.

If after these steps the text still does not fit, increase the column widths further or keep AutoFitColumns() enabled. This should eliminate the “shrunken” appearance in the Aspose .Cells viewer.

:warning: I could not fully verify this explanation against the retrieved sources. Please double-check the behaviour in your environment and confirm the exact SDK/version.

@sarathepiq,

Thanks for the screenshots.

I reviewed the screenshots, and it appears that you are using the Aspose.Cells.GridJs control to load the Excel file into it. It seems there is an issue where the contents are not fully or properly displayed in the cells. Could you please zip and attach the template Excel file here? We will investigate the issue soon.