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");
3
  • 1
    csv doesn't support styling. You would probably have to find a way to export a true excel file. Commented Jun 30, 2016 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...... Commented Jun 30, 2016 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 Commented Jun 30, 2016 at 15:44

1 Answer 1

-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/

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.