Monday, February 04, 2008

View -> JSON -> Excel report

Usually I (probably as all) used agent approach in web applications for making excel's reports. In my case I was asked to make some reports exporting all data from current view (reports should look like in view).

So I decided to use another approach (in my case it was JSON because I like it more). Here you could download the demo version how to receive data from LN database.
to receive all documents from view I used:
?ReadViewEntries&count=1000&Start=1&outputformat=json&ExpandView
to receive the name/title of columns I used:
?ReadDesign&Outputformat=json

and in the end of the story I used next code to create excel report

function
appExcel(){
if (
window.ActiveXObject){
var
xlApp = new ActiveXObject("Excel.Application");
xlBook = xlApp.Workbooks.Add();

xlBook.worksheets("Sheet1").activate;
var
XlSheet = xlBook.activeSheet;

XlSheet.cells(1,1).value = "value";
xlApp.visible = true;
}
}


This function works only in IE as far as I know.

3 comments :

tobimagwire said...

hi, im trying to access your demo, unfortunately its not there i think,

can you email it to me :)

glenn.liwanag@softwebconsult.com

Thanks

Unknown said...

Hi,
I am also very interested in this but could not access your demo. Thanks.

bruce mcpherson said...

Here are some example excel downloads with json excel connversion capabilities.

http://ramblings.mcpher.com/Home/excelquirks/json