Export to html or mhtml / web archive

Posted by: tom-gooch on 4 August 2017, 5:27 am EST

  • Posted 4 August 2017, 5:27 am EST

    The following code extract exports the report to a web archive / .mht file.  This is almost very good functionality BUT if there are any pages that are not referenced directly by a TOC entry then they are unreachable and, worse, the user is not given any clue that a continuation page exists.  What is really needed is not to have a separate file per page but to have a separate file per TOC entry.

    Have I missed something or is there really no way of doing this?  If it is not possible then can this please be considered as an enhancement request.

        Case "mht"
            Dim oHTM As New ActiveReportsHTMLExport.HTMLexport
            oHTM.HTMLOutputPath = GetParentFolderName(rsFileName)
            oHTM.FileNamePrefix = RemoveFileExtension(GetFileName(rsFileName))
            oHTM.MHTOutput = True
            If bHasTOC(oReport) Then
                oHTM.MultiPageOutput = True
                oHTM.CreateFramesetPage = True
                oHTM.TableOfContents = ddTOCSimpleHTML
            End If
            oReport.Export oHTM
  • Replied 4 August 2017, 5:27 am EST

    ActiveReports will not automatically export each bookmark to a different MHT file.  You can do this however with some code.  If each section or set of pages is its own report, you can export each report to its own file.  You would also have to build your TOC page yourself and keep track of which entry corresponds to which file.  I know of no easier way to accomplish what you are looking for however.

  • Replied 4 August 2017, 5:27 am EST

    Yes, but the problem is that we allow our users access to the designer and so we are not in full control of the report that they write.  

    We cannot allow people to make reports that look correct but actually only show part of the data.  Typical scenario is that one of our consultants makes a report for a customer and it looks fine with a limited amount of test data (and is fine in rdf or pdf output). Then one day the customer runs it on data where a group runs on to a second page and decides to select "mht" output... Then we have committed the cardinal sin of reporting - shown the user the wrong data without any warning or error.

    So we are left in a position where I don't think that we can make this almost very good functionality available.

    What I would really like to see is a "next page" and "previous page" facility added to the DHTML version of the TOC frame.  Then all pages would always be available and we would have some very happy customers.
  • Replied 4 August 2017, 5:27 am EST

    Let me see if I have a handle on the problem you are describing.

    1) You have dynamically designed reports of which you have no control over.

    2) Your TOC entries are by 'Group'.  If a group's pagecount = 1 then the code works fine.  If however, the group's pagecount > 1 then only the first page is exported?
  • Replied 4 August 2017, 5:27 am EST


    1) Not exactly, our report-designer users (usually consultants) can write reports (.rpx files) as they see fit and will not neccessarily be in control of whether the end-user wishes to have the output delivered as rdf, pdf or mht.

    2) Yes, pretty much.  Except that all the pages are exported to separate "files" within the mht but they are not accessible.  You can only navigate to pages that have a TOC entry pointing at them and you cannot scroll down beyond the end of a single page.  In this example mht file you can navigate to TOC entry EN/Customers which is page 10 (printed at the top).  The next TOC entry NO/Suppliers points to page 13.  Pages 11 and 12 exist in the mht file but are unreachable.  We simply need some way of accessing them.  Perhaps with "next page" and "previous page" buttons.

    I don't think that this is something that people should have to code round in each and every report.

    BTW - The example is very strange because it is a tutorial to show people how to use the table of contents.

    BTW2 - The consultants can only write reports against our own product/database.
  • Replied 4 August 2017, 5:27 am EST

    Sorry, it did not like an mht attachment.  Here is a zip file...
    2004/12/TableOfContents.ZIP
  • Replied 4 August 2017, 5:27 am EST

    wsmith,
    The difficulty is with setting multipagelayout of the HTML export, which exports each page to a new file.

    tom.gooch,
    I can think of several workarounds to this issue, but they depend in large part on details relating to current design limitations and limitations you may be allowed to impose.  This would most easily be discussed over the phone.  We can be reached at 614.895.3142.  Ask for Peter V.

  • Replied 4 August 2017, 5:27 am EST

    Peter answered while I was typing, making this invalid.

  • Replied 4 August 2017, 5:27 am EST

    Thanks for the phone conversation.  Here is the current version of the code that we are using to create the mht file.  This zip file now contains the rdf as well as the mht.

        Case "htm", "mht"
            Dim oHTM As New ActiveReportsHTMLExport.HTMLexport
            oHTM.HTMLOutputPath = GetParentFolderName(rsFileName)
            oHTM.FileNamePrefix = RemoveFileExtension(GetFileName(rsFileName))
            If sType = "mht" Then
                oHTM.MHTOutput = True
                 If bHasTOC(oReport) Then
                    oHTM.MultiPageOutput = True
                    oHTM.CreateFramesetPage = True
                    oHTM.TableOfContents = ddTOCDHTML
                End If
            End If
            oReport.Export oHTM

    2004/12/TableOfContents-2.ZIP
  • Replied 4 August 2017, 5:27 am EST

    I have created suggestion CR 15457 to allow for this configuration of the HTML export to navigate to pages that contain no TOC entry.
  • Replied 4 August 2017, 5:27 am EST

    I was interested in knowing about:

    oHTM.MHTOutput = True

    I am trying to export a report as MHT and cannot find this property!
    here is the code.

    <font color="#0000ff" size="2"> Dim</font> <font size="2"> _xHtml</font> <font color="#0000ff" size="2"> As</font> <font color="#0000ff" size="2"> New</font> <font size="2"> ataDynamics.ActiveReports.Export.Html.HtmlExport</font>

    rpt.Run()

    <font size="2"> _xHtml.OutputType = DataDynamics.ActiveReports.Export.Html.HtmlOutputType.LegacyHtml
    </font>

    <font size="2"> _xHtml.Export(rpt.Document, Application.StartupPath.ToString + "\" + "Temp\Rpt.html")

    There is no property named "MHTOutput"

    Is there any sample avaiable ?

    looking for help.
    Asim</font>

  • Replied 4 August 2017, 5:27 am EST

    Is this "MHTOutput" a custom/User defined object ?
  • Replied 4 August 2017, 5:27 am EST

    This is the ActiveReports 2 COM forum.  MHTOutput is a property of the COM version's HTML export.  Please see the following helpfile documents on the overrides for the HTML Export method that supports MHT:
    http://www.datadynamics.com/Help/ARNET/ActiveReports.HtmlExport~DataDynamics.ActiveReports.Export.Html.HtmlExport~Export(Document,Stream,String).html
    http://www.datadynamics.com/Help/ARNET/ActiveReports.HtmlExport~DataDynamics.ActiveReports.Export.Html.HtmlExport~Export(Document,Stream).html
  • Replied 4 August 2017, 5:27 am EST

    Thanks, I was able to do this earlier.
    Can you guide me on emailing the exported report as body of outlook express email ?
    That is not showing the report correctly.

    Any guidence?
  • Replied 4 August 2017, 5:27 am EST

    We do not support external email clients.  We can take you as far as generating the HTML, but it's beyond our expertise to to give details on Outlook.

    Also, for future questions, please post to the appropriate ActiveReports for .NET forum:
    http://www.datadynamics.com/ShowForum.aspx?ForumID=5
    http://www.datadynamics.com/ShowForum.aspx?ForumID=61
Need extra support?

Upgrade your support plan and get personal unlimited phone support with our customer engagement team

Learn More

Forum Channels