Sunday, February 16, 2014

How to export data to excel on the sd card sqlite Android


I was a beginner heroes can give a simple click of a button, such as the source "Export Data" can
1, allowing the user to select the export location
2, will read out the data in SQLite generate excel file, written in a user-selected location
justPOI can be best resolved<-! Main posts under Banner (D4) -><-! Posts under the main text (D5) ->
Reply:
Bangniding
Reply:
Bangniding recommended comma separators written CVR saved as files, you can use EXCEL spreadsheet open.
Reply:
reference to the second floor Enter_yl reply:
Bangniding recommended comma separators written CVR saved as files, you can use EXCEL spreadsheet open.
Brother, it is CVS
Reply:
First, the data is removed, followed by their use java to generate an excel data written into it, this is more flexible
Reply:
Generated from the database is very simple plain text files, text with GBK code system,
This column between columns with 0x9 that TAB delimited between lines with \ n,
File type with. XLS, is the most simple spreadsheet format it.


Reply:
I used to do export XLS C + + function is doing is very simple.
Reply:
references, 4th Floor lieri111 reply:
first remove the data, followed by their use java to generate an excel data written into it, this is more flexible
< / fieldset> Look for a demo
Reply:
reference to the 6th floor BCBPLC reply:
do I use C + + XLS export function is doing is very simple.

Java will not
Reply:
cited landlord qinghegu689 reply:
I was a beginner heroes can give a simple source such as clicking a button "Export Data" on You can
1, allowing the user to select the export location
2, will read out the data in SQLite generate excel file, written in a user-selected location
justPOI can best solve

public void datatrans_DataOut () throws IOException {/ / export data
String sql = "select * from" + TaskfieldEntry.TNAME;
String [] selectionArgs = null;
TaskfieldDAO taskfieldDAO = new TaskfieldDAO (DataTransActivity.this);
List taskBeanlist = taskfieldDAO.queryBySQL (sql,
selectionArgs);
File fileNameFile = getExportFile ();
if (fileNameFile! = null) {
FileOutputStream f = new FileOutputStream (fileNameFile);
/ / Create the workbook
HSSFWorkbook workbook = new HSSFWorkbook ();
HSSFSheet workSheet = workbook
. CreateSheet (TaskfieldEntry.CNAME_V_MEMO);
/ / Generate header
HSSFRow fieldRow = workSheet.createRow (0);
fieldRow.createCell (0). setCellValue (
/ * TaskfieldEntry.CNAME_V_FID * / "task number");
fieldRow.createCell (1). setCellValue (
/ * TaskfieldEntry.CNAME_V_MEMO * / "Job Title");
/ / Table contents
for (int i = 0; i TaskfieldBean t = taskBeanlist.get (i);
HSSFRow row = workSheet.createRow (i + 1);
. row.createCell (0) setCellValue (t.getF_id ());
. row.createCell (1) setCellValue (t.getMemo ());
}
workbook.write (f);
f.close ();
Toast.makeText (this, "Tip: Export success!", Toast.LENGTH_SHORT) show ();
.} Else {
Toast.makeText (this, "export failed, create file failed in sdcard",
. Toast.LENGTH_SHORT) show ();
}

}

No comments:

Post a Comment