Could you please make a sample Excel file using that issue could be reproduced?
Found one from public Enron case. Here is example of Excel and output it creates when asked for 1 page.
https://bit.ly/3LnNU0u
I only need page 1 in JPEG
Thanks for the details. We are further investigating this issue. Your investigation ticket ID is CONVERSIONNET-6035.
@Clemens_Pestuka @NPozdniakov
The key point is to provide SpreadsheetLoadOptions with property OnePagePerSheet = true
Here is a sample code snippet, which provides one image for the complete sheet.
using (Converter converter = new GroupDocs.Conversion.Converter("ALEWIS_0000000021.0001.XLS", type => new SpreadsheetLoadOptions
{
OnePagePerSheet = true
}))
{
ImageConvertOptions options = new ImageConvertOptions { Format = GroupDocs.Conversion.FileTypes.ImageFileType.Jpg };
options.PageNumber = 1;
options.PagesCount = 1;
converter.Convert((i,type) => new FileStream($"result-page{i}.{type.Extension}", FileMode.Create, FileAccess.ReadWrite), options);
}
Thank you. I will try that.
hmm… that doesn’t really work for me. Text on page is too small for most since we do OnePagePerSheet. I just want page 1 without any scaling. It should work exactly like for Doc file.
Do you have any other suggestions?
Thanks
We will conduct a thorough investigation once again and provide you with an update shortly.
If OnePagePerSheet
is applied - then the complete sheet is exported as one image. There is no scale, just the image, big in width and height and may need zoom to 100% to be viewed properly.
Otherwise, if OnePagePerSheet
is set to no, the worksheet is exported as 18 images. It is the same as it is exported from MS Excel.
Could you please export your sample with Excel and show us the result?
Should the PageCount/PageNumber option restrict to just 1 page (so you don’t get 18)? That is how it works for Word type documents.
PageCount
is the number of pages to convert starting from PageNumber
. Furthermore, take a look at this API reference.
Correct but my point is it doesn’t work. I specify page 1 and gives me more. Works fine for Word but not for Excel.
Please utilize following code (load option for Excel/Spreadsheet):
Func<LoadOptions> getLoadOptions = () => new SpreadsheetLoadOptions
{
OnePagePerSheet = true
};
Converter converter = new Converter(@"D:/ALEWIS_0000000021.0001.XLS", getLoadOptions);
Set OnePagePerSheet
to true and you’ll get one image in output.
@NPozdniakov
I agree with you that it does not work the way it’s intended.
If you just want to create a preview and because of that, the “OnePagePerSheet = true” is giving you a too small result, you may want to add “ConvertRange” to your SpreadsheetLoadOptions.
e.g. loadOptions.ConvertRange = “A1:AF50”;
it will of course cut off data outside this range, but for a preview / thumbnail it’s good enough.
It maybe good enough for now. Ultimately @Clemens_Pestuka is right, it doesn’t work as intended and I would like to see this fixed.
Thank you both for suggestions.
You are welcome. We’ll let you know if we implement further improvements for this scenario.
The issues you have found earlier (filed as CONVERSIONNET-6035) have been fixed in this update. This message was posted using Bugs notification tool by nikola.yankov
It appears that the issue you’re encountering is tied to the Conversion .Net 20.1 update, where the capability to convert a single page of a multi-page document into PNG has been affected. The suggested approach is to utilize SavePageStream
as a potential workaround for this problem.
However, if you’re searching for a more user-friendly, non-programmatic solution, I’d recommend trying an online tool like Converter365, a PNG converter that provides hassle-free conversions without the need to write any code. This might be particularly beneficial if you have only a few files and are looking for a straightforward method.
On the other hand, if your goal is to incorporate conversion functionalities within a more extensive system or application, then it’s essential to keep abreast of the provided code and suggestions. The problem might sometimes be specific to certain files, such as the creation of an unanticipated additional page during the conversion. It might necessitate either a more detailed investigation or an update from the software developers to resolve.