Export Flat Grid to uint8array

Answered
Matko asked on June 22, 2022

Are there any solution to export a Flexmonster Flat grid with the API. I cant use the Callback-Function with Uint8 Array, if the View is flat. The destinationType is set to plain.
 
I need the Data from a Flat View to append it on a worksheet with sheetjs.

1 answer

Public
Maksym Diachenko Maksym Diachenko Flexmonster June 22, 2022

Hello, 

Thank you for your question.

The technique for exporting the flat grid is the same as with the compact form.

  • While using the destinationType: "plain" parameter of the exportTo() API call, your data will be returned as a Uint8Array and passed into the callbackHandler.
  • Next, a 3rd party library (e.g., SheetJS) is used in callbackHandler function. It processes the resulting Uint8Array and combines multiple Excel tables as necessary.

You can set the flat form either inside the "Options" toolbar tab or the options object inside the report. Here is a code snippet how to set the grid type to flat:

options: {
  grid: {
    type: "flat"
  }
}

Please check the example of exporting the flat grid: https://jsfiddle.net/flexmonster/7fqrv5jk/

Hope it helps.

Best Regards,
Maksym

Please login or Register to Submit Answer