Hello,
We are a software publisher using your library for our Web application.
We are encountering a problem when previewing a Excel file, which a cell contains embedded picture.
Here, we can found the document in this zip test35093.7z (229.5 KB) and the screen of preview file image.jpg (83.3 KB)
Here’s the code used for the preview
using GroupDocs.Viewer.Options;
using GroupDocs.Viewer.Results;
using System;
using System.IO;
namespace Web.code.Lib.GroupDocsViewer
{
public class HtmlViewer : IDisposable
{
private readonly GroupDocs.Viewer.Viewer viewer;
private readonly HtmlViewOptions htmlViewOptions;
private readonly ViewInfoOptions viewInfoOptions;
private Stream stream;
public HtmlViewer(string filePath, LoadOptions loadOptions)
{
viewer = new GroupDocs.Viewer.Viewer(filePath, loadOptions);
htmlViewOptions = CreateHtmlViewOptions();
viewInfoOptions = ViewInfoOptions.FromHtmlViewOptions(htmlViewOptions);
}
private HtmlViewOptions CreateHtmlViewOptions()
{
HtmlViewOptions htmlViewOptions = HtmlViewOptions.ForEmbeddedResources(
// The action that will be done before each page informations is read
pageNumber =>
{
Stream pageStream = new MemoryStream();
stream = pageStream;
return pageStream;
},
// The action to do after each page information is read.
// Must be there otherwise the stream is disposed and we can't used it anymore
(pageNumber, stream) =>
{
});
htmlViewOptions.SpreadsheetOptions = SpreadsheetOptions.ForOnePagePerSheet();
htmlViewOptions.SpreadsheetOptions.TextOverflowMode = TextOverflowMode.HideText;
htmlViewOptions.SpreadsheetOptions.RenderHeadings = true;
htmlViewOptions.ExcludeFonts = false;
return htmlViewOptions;
}
public string GetPageContent(int pageNumber)
{
viewer.View(htmlViewOptions, pageNumber);
stream.Position = 0;
using (StreamReader reader = new StreamReader(stream))
{
string htmlContent = reader.ReadToEnd();
stream.Dispose();
return htmlContent;
}
}
public void Dispose()
{
viewer.Dispose();
}
}
}
I’m used GroupDocs.Viewer to latest version (25.03).
After a quick investigate on my side, i think the problem still provide by the css on the span which contains the balise.
Original css :
image.png (3.7 KB)
My modified css for picture corresponding to Excel file
image.png (3.7 KB)
I have test the solution with .Net Framework 4.7.2 and .Net 8 version.
Thanks by advanced