Mhtml to Pdf with Aspose Cells?

Since Cells support reading of Mht files and writing of Pdf files, can I purchase Cells with Email to convert Mhtml documents to Pdf? If so, sample code? :slight_smile:

Sure, it is easy to load the mht file and then save it to pdf with Aspose.Cells. The code sample:

            Workbook wb = new Workbook("test.mht");

And you may refer to some online documents for advanced features and requirements:

1 Like,

Moreover, for all types of licensing or purchasing queries, you may post in Aspose.Purchase section.

1 Like

Yep already tried that, however, without loadOptions, I was getting “This file’s format is not supported or you don’t specify a correct format.”

Using New Cells.LoadOptions(Cells.LoadFormat.MHtml) fixed that.

However, the result is a super terrible conversion.
Tried Words and the result was much better :frowning:,

Could you please zip and attach your Mhtml file, we will check your issue soon.

1 Like

Hello, sure, for now, let me report a more serious bug, I used latest Office 2021 Excel to save a spreadsheet as .dif and .prn and .slk
None of them are detected by Cells.FileFormatUtil.DetectFileFormat
Samples here: (981 Bytes)

You might wanna test if Cells can load them or not too, my report is only for DetectFileFormat wrong detection.,

Thanks for the zipped archive containing the files.

We are sorry but Aspose.Cells may not read/detect .prn and .slk files. See the supported file formats for your reference.

Do you only need to detect these file formats, we can look into it?

1 Like

Oh, my bad, saved using Excel and thought Cells would support them :slight_smile:

First of all, since Cells support Cells.FileFormatType.Dif and as you can see, my Dif file saved using latest Office 2021 Excel is not detected.

About Prn, it’s the same as text, I mean if you save your sheet in Excel 2021 in txt and prn format and compare them both, they look identical (non-printable characters vary for encoding etc)

About Slk, also human readable.

To be honest, all I might need is Cells.FileFormatUtil.DetectFileFormat and Mhtml to Pdf conversion!
Just that, now comparing the results with Aspose Words :slight_smile:
Dif, Prn and Slk are text format files. We do not support dectecting them and have no plan to support them. There is no easy way to distinguish text file formats based on file content.
Aspose.Cells supports converting Mhtml to pdf, you can simply open Mht file and save the file as pdf as the following :

 Workbook lc_WorkBook = new Aspose.Cells.Workbook("test.mht");
            lc_WorkBook.Save( "dest.pdf");

Thanks, already tested many mhtml files, literally I can say the output is junk, to reproduce, kindly test my ready to run project sample: (22.0 KB)

After extraction, and before opening the project, kindly copy Aspose.Cells.dll and Aspose.Words.dll to the project folder: WindowsApplication55

When you run the project 2 PDF files will be made:

  1. Made by Words
  2. Made by Cells
Through the sample file you provided, we can reproduce the issue after testing.
We have opened the following new ticket(s) in our internal issue tracking system and will deliver their fixes according to the terms mentioned in Free Support Policies.

Issue ID(s): CELLSNET-53590
1 Like

Hello and thanks,
Under the Email folder of Aspose Email data files, there are some eml/mht sample files too, kindly test them using my project sample to see more, if needed.,
We couldn’t find the email folder you mentioned. Would you like to compress the file and upload it here? Alternatively, provide a link that can be downloaded.

1 Like

Kindly test these 2 Mhtml files to convert to Pdf using:
Dim MyWorkbook As Workbook = New Workbook(My.Application.Info.DirectoryPath + “\mht.mht”)
MyWorkbook.Save(My.Application.Info.DirectoryPath + “\pdf.pdf”) (14.5 KB),

Thanks for the sample MHTML files.

I tested by converting the two .mht files to PDF and got layout errors and other issues. I have logged your new .mht files with the ticket (“CELLSNET-53590”) into our database. We will consider these two files when resolving your issue.

Once we have an update on your issue, we will let you know.

1 Like

Thanks, I’m surprised, are you working on 2 separate codes to convert mhtml to pdf within Words and Cells?!!!
Writing such complex algorithms from 2 different routes within the same company is a mystery, why not using Words code base? :smiley:,

Yes, there are separate codes and implementations for converting between mhtml and pdf for different products(such as Cells and Words). For the conversion features, the original design of different products is focused and based on the specific product separately. For example, for Aspose.Cells the primary file format is excel-related formats such as xls, xlsx, …etc. For the original design of converting other formats such as html, pdf, the main goal is to achieve same or similar result with what you can get by ms excel. When importing file formats such as html, we also mainly focus on those ms excel oriented(generated) html files.

There are also similar progresses for other products. Of course, in the process of product evolution, those features have been enhanced, more functions are added and extended. But still the focus and base are different for different product.