I found a sample project named DHlibxls could read file from Excel.
But... the problem is, I wanna write data to Excel file.
My idea is store an excel file template in the app, and write data to the excel file by actions user did in the app and thus create a new excel file for emailing..
PS: Don't urge me to convert to CSV or other format, the client's tough and he insists on the excel format.
Related
I use an excel file with suffix is ".xlsx", qaf use CSVUtil to analyze this file, and throwing exception.
If I use ".xls" file, it worked well.
As of qaf version 2.1.15 Excel file with xlsx extension is not supported. It is lower priority feature may be because people prefers xml/json/csv format over xls and feature available to have custom data providers as well.
Another alternate is using CSV files (with .csv extension) which can be opened in Excel for editing as well as can be edit/view outside Excel. For example consider git as repository, one can review/edit pull request if it is csv but not if it is xlsx.
In my iOS application, I want to generate the excel(.xlsm) file.
I used the libXl library.(http://www.libxl.com/)
This library can support Excel 97 -2003 formats (xls) and Excel 2007-2013 xml formats (xlsx/xlsm) by referencing in the home page.
Now my problem is I can export xlsx file fomat but cannot export the xlsm application in my application .
Do you know how to do this?
You can't use libXL to create macros, but you can preserve existing macros. I.e. you can take an excel macro-enabled file as a template, read it with libXL, make some modifications and save.
To save .xslm rather than .xslx you only need to give the file a different extension. File format is the same. Excel won't open an .xlsx file if it has embedded macros, but it's only a convention.
I need to read xls files in my IOS app. First of all, I want to convert xls files to csv format files, then my app parse csv files, but I can't find any ios library to convert xls to csv, please help me
If you have a .xls file, you can use the open source DHlibxls library to read the file into your app. This is an ObjectiveC framework that wraps a C-based library. The library is quite mature.
ios or any objecive-framework doesn't provide any thing for accesseing Microsoft's xls :(
To convert-xls to/fro csv is itself a project in it!!!
On top of this, there are different format of xls, now xlsx files. And writing a xls and reading it back in proper way is tooooo-cumbursome task to accomplish. However we have managed to read it but it is not 100% efficient :(
I guess in near future you may want to move to xlsx file then your task will be a lot more difficult. You can check yourself, change the file name extension to .zip and unzip you will see many files, one having row numbers, another columns, third with links, fourth with contents and so on. Mapping and getting in correct form in not impossible but needs a lot of work.
There can be many other ways to do, I can suggest to use java api to do, or even save you xls to csv directory from excel, then your work will be easy.
I need to export some data to an .XLS file, pdf, and print.
I already tried the simple solution: exporting it to .CSV with CHCSVWriter. It works for printing and saving it to pdf (I open the CSV in a UIWebView and get the PDF or print from there). However, to use the CSV to be open in excel has two main problems:
1 - First, as the name says, in the CSV the values are separated by commas, and in some versions of Excel, it requires the user to separate 'manually' in cells.
2 - I have hebrew characters, and I already tried all the string encodings, and can't have both hebrew and latin characters.
So, after giving up after days of trying to use CSV to solve the issues above, I gave up. How can I export my data to XLS?
The LibXL library provides this functionality for both xls and xlsx formats. There is no iOS version, but people say the iOS version is coming. You may want to contact LibXL support to confirm this.
EDIT:
The iOS version is available now.
This article explains how to programmatically create an Excel (.xls) file without using any external library. It just opens a file stream and it writes XML contents straight to it.
It is written in C#, but the core information coming out of it is the XML formatting used to create nodes and fill attributes for corresponding cell values and formatting.
Please consider I have not tried this myself, I found it while doing a search. Please feel free to ask if some C# bits are not clear. HTH
I have a large amount of data to insert into an worksheet of an existing Excel workbook. The Excel workbook will have other worksheets containing calculations and a pivot tables. The data may have as many as 60,000 rows and more than 30 columns. This solution must work for both Excel 2003 and Excel 2007.
Using the Excel OLE object is way too slow so we are attempting to load the data from a CSV file. We have come up with a method to load the data by placing the data onto the clipboard and then pasting it into the worksheet. I feel this is a quite a kludge. Is there another way to programmatically load a CSV file into a worksheet? Or perhaps a different solution altogether?
Update: We got slammed with another task before we could fully investigate the answers. We should be able to get back to this in a couple of weeks. I'll be sure to update again when we get back to this task.
Thanks for all of the answers to date!
XLSReadWrite is a component that can read and write excel files from Delphi. It's fast and it has support for Excel 2003 and 2007. You can create new excel files as well as open existing ones and add/modify them.
Also you do not need to have Excel installed to be able to use it.
See http://www.axolot.com/components/xlsrwii20.htm
Any chance you can drop the requirement for this to work with Office 2003? I would have recommended the Open XML Format SDK. It lets you bind managed code assemblies to spreadsheet documents that can handle events such as Open or Close, and read and write to cells in the document, among other things. Alternatively, you can use it to manipulate XSLX documents from an application. Quite slick, actually.
Since this won't work for you, how about writing a macro that pulls in the CSV file when the spreadsheet is loaded?
you can load the csv into listview or usin OLEDB provider to load it on DBGrid, then export it into xls file format using TMxExport component from Max Components:
Max Components
Have you tried linking the csv file directly into the worksheet.
Go to Data -> Import External Data -> Import Data
change the file type to 'Text Files'
You can then refresh the worksheet when the csv is update.
NOTE: I have not done this with the volume of data you have indicated, so YMMV
Actually there is a way that is quite fast, pretty old tech (nowdays) but is probably the fastest.
It's ADO or for earlier versions DAO (note not ADO.NET)
You can read a CSV file using ADO and the JET Engine to get the data into a ADO recordset, then an Excel Range Object has a CopyFromRecordSet method that will copy (very fast) from the ADO (or DAO) recordset.
http://msdn.microsoft.com/en-us/library/aa165427(office.10).aspx
You can try to use Tab Separated Values instead of CSV - than you just paste this into Excel :)