How to create EXCEL and WORD file using SuiteScript 2.0? - javascript

I'm using HTML Suitelet to create Word and Excel, I'm able to create CSV and PDF files but I am unable to create a Word or Excel. How do I do it?
file.create({name:'testinvoice.pdf',fileType:file.Type.PDF, contents:pdffile.getContents()});

Take a look at the file.Type enum in the help center. file.Type.WORD and file.Type.EXCEL are both supported, but your file.Create may be failing because the contents may not be create. I think this stack overflow question will be helpful with creating an XLS file: Create Excel File in NetSuite's SuiteScript

Related

Converting XML SpreadSheet to XLSX using Javascript

I need to convert a XML SpreadSheet to a native Excel file (XLSX), without using MSOffice.
In particular I need to make this conversion using Javascript.
I'm searching for in "StackOverflow" web page and also in google and other portals, but I don't find nothing about it.
The XML SpreadSheet sample file is like this:
enter image description here
On the other hand, I've discovered the "excelcnv.exe" command for conversion between formats, included in MSOffice Excel installation, but just I got to convert from XLS to XLSX, but not from XML SpreadSheet to XLSX...In fact I haven't found any documentation about this "excelcnv.exe" command so I don't know if it is possible this conversion.
Also I've found about some javascript libraries like oxml.js or XLSX but I think this libraries allow create a native excel file from scratch, not convert from input files in XML SpreadSheet format.
Maybe anybody could know how do this using javascript or some javascript library.
Any help will be very welcome :)
Thanks in advance,
You need to change the file extension. From xml to xls.
Then excelcnv will convert correctly.
excelcnv.exe -oice <INPUT> <OUPUT>

Can not open exported excel file in ExcelJS

I have used ExcelJS libary in my JS project. It works fine with English letters. But if I change my application language in to French and export the content as a excel sheet. Then the below mentioned error is coming. Anyone know what cause this issue and a solution for this?
In my scenario I am using ExcelJS to convert/create an excel file using my fin-hypergrid table. The reason which caused this issue is in my fin-hypergrid table I had two columns with same name. Then excelJS will add unknown character at the end of the column name. That was the reason, which cause the above error.

Javascript (Angular Js) exporting Json as excel (with letters in fonts)

I am trying to implement to Json to Excel exporting in javascript. I am using angular js. I was to able to generate Json to CSV but i cant not retain font(bold) and macros in CSV (because its csv).
Is there any opensource in the market for Json to Excel conversion by retaining font colours for the text.
There is an interesting project on github called Excel Builder (.js)
that offers a client-side way of downloading Excel xlsx files and includes options for formatting the Excel spreadsheet.
https://github.com/stephenliberty/excel-builder.js
You may encounter both browser and Excel compatibility issues using this library, but under the right conditions, it may be quite useful.
The demos on github project with less Excel options but less worries about Excel compatibility issues can be found here: ExcellentExport.js
https://github.com/jmaister/excellentexport
The demos seem to hold some promise.
http://excelbuilderjs.com/index.html
If you are using AngularJS, there is ng-csv:
a "Simple directive that turns arrays and objects into downloadable CSV files".

PHP generate PDF and edit

I would like to ask
Is it possible to edit the PDF file? For example, insert a new pages between pages , like add page between page 17 and 19.
Which library can i use?
one way to do this is to use ghostscript to split the pdf into individual page images and then you can add additional pages and rearrange pages as needed with tcpdf or similar pdf library.
You can generate pdf easily using FPDF library http://www.fpdf.org/. But you can not edit them via this library. You can use FPDI library mentioned here: PDF Editing in PHP?.
Here is my view:
It is easy to edit Hypertext rather than PDF it self. I use TCPDF to convert HTML to PDF.
Take a look at this. It might be helpful : TCPDF_import is not bringing in an existing file
Thanks, Let us know if you find a better solution.

Can any body tell me how to open a FIle with .dat extension in cent os?

In my new Ruby on rails application I want to find the users country code.
So I am using MaxMind GeoIp. when I downloaded the gzip file after gunzip it gives me a GeoIP.dat file and I am stuck here. Can any one help.
If their is a program to open it or some procedure to use it.
Or if any one can suggest me the other way.
As #Kyle pointed out, you can download "human-readable" CSV files instead of binary DAT files. MaxMind's "GeoLite" downloads are here.
The CSV file format is described here.
But note (from the link above):
Due to the large size of geolocation databases, we generally recommend using our binary format with one of our APIs, since they are highly optimized for speed and disk space. On the other hand, if you have a requirement to import the data into a SQL database, the CSV format is recommended.
The APIs are listed here. There is no Javascript API listed, but there are a couple of options for Ruby.
So to answer your question directly: You would not "open" the dat file directly as you would a spreadsheet document. Instead you would write your own program that uses their API to read the dat file, and perform whatever tasks or queries you design it to do. Check out their API documentation for details of how you might get started with that.
.dat is just a file extension. The contents could be anything. Text. Binary data etc...
There is no way anyone could reliably tell you how to open the file.
I would attempt to view the contents of the file from the command line:
less file_name.dat
You can open the file and read line by line in ruby like this:
IO.readlines('file_name.dat').each do |line|
# do something with the line
end
Edit: I think I found the file you're refering to. Why not go here and download a csv version? The .dat version is not in plain text.

Categories

Resources