Home Server
New Blog Posts: Merging Reports - Part 1 and Part 2

TrsWebTier.GenerateContent: No content provider for reques

edited November 2016 in Server
Hello,

We are converting to RbServer 17.03 and want to save output to Excel
(xlsx format).

In order to get this working we found a post with a an answer from
Nard Moseley:

"Try adding rsWebAdapterXLSData to the 'uses' of your web tier app.
Then use content=XLS

If you prefer to use content=XLSData, this requires a simple
modification.
Modify rsWebAdapterXLSData.pas, the methods ContentType and
WebContentType."


The first part is working fine. We now get output to Excel.
When we modify rsWebAdapterXLSData.pas to use XSData, we get an error:
TrsWebTier.GenerateContent: No content provider for reques.

Is this setting used to save to xlsx files? Or can you tell me what to
use in order to generate xlsx files.

Thanks,

André Konijnendijk.

Comments

  • edited November 2016
    Hi Andre,

    For RB 17.x include one of the following units in the 'uses' clause of the
    WebTier app.

    rsWebAdapterXLSData

    rsWebAdapterXLSReport

    Have a look at the source for the above units. They are very simple, just a
    few methods, each method has one line of code. Post a follow up here if you
    have more questions.

    You'll need to rebuild the WebTier app and then either reboot the web server
    machine or stop the IIS Application Pool and restart it.




    Best regards,

    -
    Nard Moseley
    Digital Metaphors
    www.digital-metaphors.com

    Best regards,

    Nard Moseley
    Digital Metaphors
    www.digital-metaphors.com
  • edited November 2016
    Hi Nard,

    I finally get the XLSData to work.

    In addition to your suggestion, I had to change the uses of
    ppXLSDevice to ppXLSxDevice and create a TppXLSxReportDevice and
    TppXLSxDataDevice.
    I also het to use xlsdata in the TrwWebLinkCreator().
    CreateLastRequestLink

    The next problem I ran into is the file extension from the generated
    report, it becomes "xlsdata".
    When the file is rename to ".xlsx", it can be opened in Excel 2016.
    When renamed to ".xls" Excel generated a warning about the expected
    fileformat.

    So I think the file-format is what I want, only the extension is
    wrong.

    Where can I change the used file extension?

    Thanks,

    André.


    On Mon, 28 Nov 2016 16:28:40 -0600, "Nard Moseley \(Digital
  • edited November 2016
    Hi Andre,

    In your original post, I missed the part about wanting to export to xlsx.

    Save either rsWebAdapterXlsData.pas or rsWebAdapterXlsReport.pas to a new
    unit named either rsWebAdapterXlsxData or rsWebAdapterXlsxReport

    Update the 'uses' from ppXlsDevice to ppXlsxDevice

    The ContentType and WebContentType must be 'Xlsx' since this is the file
    extension.

    The CreateDevice method should create the appropriate device instance.

    Then add the relevant unit to your web tier app.

    The web tier can only 'use' one of rsWebAdapterXlsxData,
    rsWebAdapterXlsxReport. It cannot use both.

    There I no need to modify the WebLinkCreator. That issue was caused by the
    incorrect file extension.


    For RB 18, I'll look at including units for rsWebAdapterXlsxData,
    rsWebAdapterXlsxReport




    Best regards,

    -
    Nard Moseley
    Digital Metaphors
    www.digital-metaphors.com

    Best regards,

    Nard Moseley
    Digital Metaphors
    www.digital-metaphors.com
  • edited November 2016
    Hi Nard,

    Thanks for the respone. It is working.
    One additional remark: I also had to modify the WebLinkCreator to
    "TrsWebLinkCreator(LinkCreator).CreateLastRequestLink('xlsx')"

    Best regards,

    Andre

    On Tue, 29 Nov 2016 12:25:41 -0600, "Nard Moseley \(Digital
  • edited December 2016

    Yes. I was not clear on what you were doing.

    For the custom nav toolbar example installed to

    Public\Documents\RBServer\Delphi X\Demos\Web Tier\Custom Viewer

    The method TmyWebViewerFrameNav.CreateExcelButtonScript would need to be

    lTemplate.SetVariable('link',
    TrsWebLinkCreator(LinkCreator).CreateLastRequestLink('xlsx'));




    Best regards,

    -
    Nard Moseley
    Digital Metaphors
    www.digital-metaphors.com

    Best regards,

    Nard Moseley
    Digital Metaphors
    www.digital-metaphors.com
This discussion has been closed.