Exporting AC2007 Report with Images to HTML

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • scubasteve
    New Member
    • Jan 2008
    • 13

    Exporting AC2007 Report with Images to HTML

    I'm a fairly experienced Access/VBA developer, but I haven't been able to find a solution for this issue yet.

    I'm using AC2007 to build a product management system. The main purpose of this system is to publish a product catalogue in a format which can be put on a CD and opened by virtually any PC. It needs to have good internal navigation, to make it as user-friendly as possible.

    Building the system is no issue. Creating the catalogues is!

    The best way I've found so far is to export Access reports containing hyperlinks to HTML. This works fine, but I'm having an issue with the product images not showing in the exported HTML files (they do appear on the report when viewed in Access).

    I've currently got the image files (mostly .jpgs) stored in an Attachment field. I've done all of my development up to now in AC2000-3, so haven't had to deal with these so far.

    Can anyone tell me if I'm on the right track here? Any (useful) suggestions are appreciated!
  • Megalog
    Recognized Expert Contributor
    • Sep 2007
    • 378

    #2
    Hi there!
    I use Access 2007 and have done a bit of tinkering on exporting reports with graphics..
    So far, I havent been able to get html exports to show images. But, you can download the free pdf plug-in for access 2007, and export away to PDF.
    From there, I believe you can export to HTML, or at the very least, convert the PDF to DOC, then convert to html....

    But as far as a straight Access report with graphics, to an HTML file.. I've had no luck at all. Not saying it cannot be done, so maybe someone else will have had some luck in this area.

    Comment

    • scubasteve
      New Member
      • Jan 2008
      • 13

      #3
      Thanks Megalog, I'll investigate exporting as pdf then converting to HTML.

      The only other option I can think of is to write some VBA to edit the HTML after it's been produced, to insert the img tags. A little messy, but at this stage whatever works is the right option.

      Unless anybody else has a better idea?

      Comment

      • Megalog
        Recognized Expert Contributor
        • Sep 2007
        • 378

        #4
        Originally posted by scubasteve
        Thanks Megalog, I'll investigate exporting as pdf then converting to HTML.

        The only other option I can think of is to write some VBA to edit the HTML after it's been produced, to insert the img tags. A little messy, but at this stage whatever works is the right option.

        Unless anybody else has a better idea?
        Hm you said in your first post the images were in Attachment fields.. so I assumed they were embedded graphics within your database. If you have the graphics stored externally, then you can can set up your report to output the code needed to hyperlink those, as long as you have the correct paths handy.
        Like this expression I use in a query, that I dump to html:

        Code:
        File Link: IIf(IsNull([FilePath]),[FileName],'<A HREF="' & [FilePath] & '">' & [FileName] & "</A>")
        In my table, I've got a field for file names, and a field for the path to it. If there is a path, it gives a hyperlink to it. If there isnt, it just lists the file(record) name. You could easily set it up to do the same with displaying graphics, if your table data supports it.

        The only problem, is that it doesnt show the graphics in the normal report view. So maybe have an alternative report for the html exports?

        Comment

        • jaxjagfan
          Recognized Expert Contributor
          • Dec 2007
          • 254

          #5
          HTML Docs look for images from the root of the site or cd or where the page exists. If all of your images are stored in a folder called "images" then the HTML would look similar to the following:

          Code:
          <img src="file:///images/logo1.jpg" width="293" height="84" />
          href is a hyperlink and would display "file:///images/logo1.jpg" width="293" height="84" in my case unless I supplied alt text.

          Have you tried "Pages" within Access (Depends on version you are using)? Most web catalogs are dynamic.asp pages vice static html pages.

          Comment

          • scubasteve
            New Member
            • Jan 2008
            • 13

            #6
            Thanks for all the suggestions so far.

            I've made some progress, but still haven't come up with an ideal solution. Here's my thought processes so far, hopefully they might help someone in the future!

            My client currently has a product catalogue (of sorts) in Excel. It's used to maintain product information, and produce product catalogues. It requires a lot of maintanance, and is hard to update prices automatically.

            I'm going to build a suitable Access db to store all the product info - category, sub-category, description, photo, etc. This makes maintenance much easier, and hopefully means creating product catalogues will be much easier as well. It's also a good interim step towards going fully web-based in 18 months or so.

            They want to distribute their product catalogues on CD, and have them accessible to as many people as possible, without everyone having to download extra software. For this reason, HTML seems ideal, PDF a good second choice. Access run-times aren't.

            The catalogue needs to be easily navigable, with both internal and external hyperlinks. It needs to contain product images (which can either be embedded in the db, or stored externally, whatever's best). It also needs to contain hyperlinks to open pdf documents, and ideally PowerPoint slides and movie files as well.

            Rather than have one huge report with layers of nested subforms, I was thinking I'd have 4 reports - a title page, division, category, and sub-category. I'd use VBA to print out one title page, one division report for each of the 3 divisions, one category report for each of the 30+ categories, and one sub-category report for each of the 200+ sub-categories. They'll need external hyperlinks between them, so at report creation time, I'd need to know the exact name of every pdf or html file. Those hyperlinks need to be relative so the system can be used on any PC, not just the one it was created on.

            I've set up a test db to find a way to create html or pdf docs with images and functional hyperlinks.

            I've created a test report to show the image for each product in 3 ways - in an Attachment field, as an OLE object, or as a stored text path, using the report OnFormat event to display the images.

            I've also set up hyperlinks to simple test files Test.html and Test.pdf. For each of those, I've got hyperlinks for both relative (filename only) and absolute (fully qualified) paths.

            When I view this report in Report View, the attached images show fine. The OLE ones don't show at all. The external images only show when in Print Preview view, as the OnFormat event isn't triggered until the report is printed.

            When I export the report to HTML, then open in a browser (IE or Firefox), none of the images show. The relative hyperlinks both work, but not the absolute ones, so navigation and opening pdfs is fine.

            When I save as PDF (using the MS Office 2007 plugin), and open in Acrobat Reader, only the attached images show. All the hyperlinks work, but the PDFs are opened in a browser window, not Acrobat.

            Also, only the first product record on each page is shown (there are 10 in tblProducts). The rest of each page is blank, so I have product 1 at the top of the first page, and product 8 at the top of the second. ?????

            I've tried a few pdf -> html converters, and none have provided an acceptable result.

            So, it looks like the path of least resistence from here is to export from Access to HTML, then write some VBA to edit the HTML, adding img tags. At least this way, hyperlinks between the html files remain intact, and pdfs open from hyperlinks no trouble.

            Comment

            • scubasteve
              New Member
              • Jan 2008
              • 13

              #7
              After even more research, if you:

              - Export an Access report to XML
              - Make sure you export the XSL as well
              - Add a line in the XML file telling it how to use the XSL (insert at second row of file: <?xml-stylesheet type="text/xsl" href="MyFile.xs l"?>)

              then you can end up with an XML file which, when opened, looks like HTML, with working hyperlinks. It doesn't have the problem of splitting each report into several HTML files, or putting wrapped text in a report into separate lines in an HTML table.

              The images are still an issue. There's also the issue of, whenever one of these XML files is opened, the user's asked if they want to allow the script to run.

              So, does anyone know how to convert an XML file, with an associated XSL, into HTML? I've found one trial program, ABC Amber XML Converter, but it converts jpgs into bmps.

              Comment

              Working...