locked
Best Approach for Reporting from a Metro Style App

    Question

  • Hello There

    I am looking to produce a report from my Metro Style Application using JavaScript and HTML5.  Ideally, I would like to create the report as a pdf file, but it doesn't seem that this will be possible.  Is this correct?

    If not, what would be the best approach? - would exporting my report as an HTML file be the best way using Winrt?  Am I right in thinking that I can then programtically launch the report in Explorer (assuming that the HTML file type is associated with Explorer).

    Many thanks

    Geoff Olding

    Monday, May 21, 2012 11:00 PM

Answers

  • Hi,

      >>  I would like to create the report as a pdf file, but it doesn't seem that this will be possible.  Is this correct?

    You can create a PDF report. But there’s no built-in API that helps us to create PDF documents. We need to write our own, or find a third party JavaScript library that supports PDF.

      >> what would be the best approach? - would exporting my report as an HTML file be the best way using Winrt?

    If you use html, it will be easier. Actually you can use JavaScript DOM API to generate the html document. But please be careful with links, though. For example, it is needed to store images separately, and link them to the html document. PDF allows you to use a single file, but html doesn’t. The advantage of html is it’s more widely adopted. Almost any device can view html documents without external apps.

    As for opening the generated document, yes, you can use the Launcher API. Please refer to http://msdn.microsoft.com/en-us/library/windows/apps/windows.system.launcher.aspx for more information. The default program associated with the file will be opened. For example, by default Microsoft Reader will be opened to display PDF files, and IE will be opened to display html files.

    Best Regards,

    Ming Xu.


    Please mark the replies as answers if they help or unmark if not.
    If you have any feedback about my replies, please contact msdnmg@microsoft.com.
    Microsoft One Code Framework


    Tuesday, May 22, 2012 7:20 AM
    Moderator

All replies

  • Hi,

      >>  I would like to create the report as a pdf file, but it doesn't seem that this will be possible.  Is this correct?

    You can create a PDF report. But there’s no built-in API that helps us to create PDF documents. We need to write our own, or find a third party JavaScript library that supports PDF.

      >> what would be the best approach? - would exporting my report as an HTML file be the best way using Winrt?

    If you use html, it will be easier. Actually you can use JavaScript DOM API to generate the html document. But please be careful with links, though. For example, it is needed to store images separately, and link them to the html document. PDF allows you to use a single file, but html doesn’t. The advantage of html is it’s more widely adopted. Almost any device can view html documents without external apps.

    As for opening the generated document, yes, you can use the Launcher API. Please refer to http://msdn.microsoft.com/en-us/library/windows/apps/windows.system.launcher.aspx for more information. The default program associated with the file will be opened. For example, by default Microsoft Reader will be opened to display PDF files, and IE will be opened to display html files.

    Best Regards,

    Ming Xu.


    Please mark the replies as answers if they help or unmark if not.
    If you have any feedback about my replies, please contact msdnmg@microsoft.com.
    Microsoft One Code Framework


    Tuesday, May 22, 2012 7:20 AM
    Moderator
  • Many thanks
    Wednesday, May 23, 2012 4:16 AM