0

Thanks to GBI's code (Export array of objects into Excel using Javascript), I was able to export an array of objects to javascript, see my code below. My question about this is, can I do any excel styling? The title will be my header, and I want to add borders, bold, etc. but there doesn't seem to be any option for styling.

        var fso = new ActiveXObject("Scripting.FileSystemObject");
        var s = fso.CreateTextFile("C:\\REPORT.csv", true);
        var title = "GROUP, HOURS TYPE, EMPLOYEE TYPE, PREV, JAN, FEB, MAR, APR, MAY, JUN, JUL, AUG, SEP, OCT, NOV, DEC, TOTAL";
        s.WriteLine(title);

        s.Close();
        alert("Report Saved as C:\\REPORT.csv");
Community
  • 1
  • 1
jesse
  • 71
  • 2
  • 8
  • 1
    csv doesn't support styling. You would probably have to find a way to export a true excel file. – IrkenInvader Jun 30 '16 at 15:31
  • Irk, I think you're right. I wasn't thinking that this is actually writing to a text file. There are no cells, so there's nothing to style. Back to the drawing board...... – jesse Jun 30 '16 at 15:40
  • I've always made excel files on the backend, usually c# of vb.net. Not sure if that's an option for you -- if not it looks like there might be a few js libraries that can do it – IrkenInvader Jun 30 '16 at 15:44

1 Answers1

-1

Not sure if is there a way in javascript, but if you are using php check this https://stackoverflow.com/a/3969030/6495164

EDIT: PHP Excel is here: https://phpexcel.codeplex.com/

Community
  • 1
  • 1
danielarend
  • 1,379
  • 13
  • 26