Excel content is not full visible

Dear Team,

We are using groupdocs viewer for viewing the excel file but the contents inside multiple cells are not fully visible. When we expand the excel column width then we are able to view it. Is there any way to show full text inside the column, added sample excel file in the attachments.
Excel_WithTextOverFlow_Sample.zip (6.4 KB)
Excel_WithTextOverFlow_Sample.zip (6.39 KB)

Hello Anoop!

Thank you for being interested in the GroupDocs.Viewer!

While opening your sample XLSX file in MS Excel, the text in columns D (DESCRIPTION-1) and E (DESCRIPTION-2) is not fully visible, because it is occluded by the other content in consequent columns, and only the text in the column F (DESCRIPTION-3) is fully visible, because there is nothing behind it.

The GroupDocs.Viewer tries to mimic the MS Excel behaviour, and that’s why you’re obtaining the result as you have. But, of course, this can be overriden.

Unfortunately, you have not attached a piece of source code you’re using so I cannot point you out onto the specific method or property, but here is an example of source code, which will display the whole Excel worksheet (tab) as a single document, with headings, and column width will be automatically expanded to fix the whole text content.

using GroupDocs.Viewer;
using GroupDocs.Viewer.Options;
//..............
using (var viewer = new Viewer("Excel_WithTextOverFlow_Sample.xlsx"))
{                
	var viewOptions = HtmlViewOptions.ForExternalResources("page{0}.html", "page{0}/resource{1}", "page{0}/resource{1}");
	// tune the SpreadsheetOptions
	viewOptions.SpreadsheetOptions = SpreadsheetOptions.ForOnePagePerSheet();
	viewOptions.SpreadsheetOptions.RenderHeadings = true;
	viewOptions.SpreadsheetOptions.TextOverflowMode = TextOverflowMode.AutoFitColumn;
	
	viewer.View(viewOptions);
}

More on these specific and all in general options, related to the Spreadsheet rendering, you can find in the articles Specify spreadsheet rendering options and Split a worksheet into pages.

Thanks!

Dear Team,

Thank you for the feedback.

I have implemented the suggested code changes in my solution. However, it appears that the content under the “DESCRIPTION” columns is not fully visible, except for the last column.

I have attached the updated code for your reference. Kindly review the changes, and please advise on any further adjustments needed to ensure the complete visibility of the content in the “DESCRIPTION” columns.

Thank you for your attention to this matter.

Regards,
Anoop

Code_Set.zip (886 Bytes)

Hello Anoop!

I’ve examined the source code you have attached and there are few things I want to explain:

  1. The provided source code does not perform a rendering the document to the HTML at all. The “GetViewerLoadOption” returns the load options, and “GetViewerInfoOption” returns the ViewInfoOptions. But for the rendering to the HTML the HtmlViewOptions are required, not the ViewInfoOptions.

  2. Also, it is not enough to instantiate and tune the HtmlViewOptions, you also need to invoke a Viewer.View instance method. In your code you’re calling a “viewer.GetViewInfo” method, which does different things.

  3. Finally, you’re tuning the “SpreadsheetOptions” property in the viewInfoOptions instance, but then re-creating it with the SpreadsheetOptions.ForSplitSheetIntoPages(5000) static method; this call creates a new instance of the SpreadsheetOptions, so the previously setted “RenderHeadings”, “RenderGridLines”, and “TextOverflowMode” parameters are discarded.

  4. In order to render the document to HTML and make all values in all cells fully visible you need to do something like this. I’m mixing the code you’ve provided with my inclusions. Implementation details may differ in your case, but the main idea should be the next:

using (Viewer viewer = new Viewer(stream, GetViewerLoadOption(fileName, password)))
{	
	HtmlViewOptions viewOptions = HtmlViewOptions.ForEmbeddedResources();

	//create SpreadsheetOptions at first step
	viewOptions.SpreadsheetOptions = SpreadsheetOptions.ForSplitSheetIntoPages(5000);

	//then tune it at second step
	viewOptions.SpreadsheetOptions.RenderHeadings = true;
	viewOptions.SpreadsheetOptions.TextOverflowMode = TextOverflowMode.AutoFitColumn;

	//render file to HTML with view options at third step
	viewer.View(viewOptions);

	//other code from your example
	var viewInfoOptions = GetViewerInfoOption(fileName.Split('.').Last());
	//this is at 1st place!
    viewInfoOptions.SpreadsheetOptions = SpreadsheetOptions.ForSplitSheetIntoPages(5000);
	
	//and adjusting the properties is the next
	viewInfoOptions.SpreadsheetOptions.RenderHeadings = true;
    viewInfoOptions.SpreadsheetOptions.RenderGridLines = true;
    viewInfoOptions.SpreadsheetOptions.TextOverflowMode = TextOverflowMode.AutoFitColumn;
    
	//this does not render, but returns a view info
    var viewInfo = viewer.GetViewInfo(viewInfoOptions);
	
	//...all other code
	
}
  1. Finally, after executing this code, and with your sample file “Excel_WithTextOverFlow_Sample.xlsx”, the result will be the same as I have attached to this answer: “p_1.html” file in ZIP archive.
    p_1.zip (2.0 KB)

Dear Team,

Thank you for the feedback.

I was able to resolve my issues by using the above code changes.

Regards,
Anoop

Hello Anoop!

Glad to hear that. You’re welcome!