affirm that the following articles belong to reprint, now everyone new download version with the following column this is not the same! I read a lot of online, and finally I went to the English handbook, which said very clearly! Everyone English is not good can download Youdao! in fact, the focus is to include the following two lines:Require_once ' excellib/phpexcel.php ';Require_once ' excellib/phpexcel/iofactory.php ';Each of you replaces the respec
'oleread. php ';
Create a new php file and introduce reader. php. The Code is as follows:
The Code is as follows:
Copy code
Require_once 'excel/reader. php ';$ Data = new Spreadsheet_Excel_Reader ();$ Data-> setOutputEncoding ('gbk'); // encoding is set here, generally in the gbk mode.$ Data-> read('Book1.xls '); //
Learn something new and grow stronger every day, hehe.
One: Java reading and writing
Read the file:
FileInputStreamCreate a FileInputStream by opening a connection to the actual file that passes through the path name in the file system
Name specifies. Creates a new FileDescr
Export data to an XLS-formatted Excel file using Phpexcel
In the development of a business license management system at the time need to export data to Excel files, although a year ago to do a group of ERP when used to import and export, but too busy at that time to write a blog, a year passed I also forget the almost, so take advantage of this use today to write to the blog, As a reference for future devel
functions, such as inserting pictures and so on, which are no longer introduced here, readers can explore themselves.In: Suppose you read an Excel and need to know how many rows and columns it has, such as the following:Workbook book = Workbook.getworkbook (New File ("Test 1.xls")); Get the first sheet object Sheet Sheet = book.getsheet (0);
in the reader.php file (the first line is both), change to the correct oleread.php path: require_once ' oleread.php ';
Then create a new PHP file to introduce reader.php with the following code:
copy code
"!--? php require_once ' Excel/reader. PHP '; $data = new Spreadsheet_excel_reader (); $data->setoutputencoding (' GBK ');//set encoding here, generally GBK mode $data-
) Hssfsheet sheet = workbook.getsheet (sheetname); if (sheet!=null) flag = true;} catch (Exception e) {e.printstacktrace ();} }else{//file does not exist flag = false;} return flag;} /** * Create new Excel. * @param filedir Excel Path * @param sheetname the table index to create * @param titlerow the first line of Excel, the table header */public void Createexcel (Strin G filedir,string sheetname,string titlerow[]) {//Create workbook workboo
1. Create TXT fileJust write according to normal logic.First define a file given a path--to determine if the file does not exist on this path--and if it doesn't exist, it will be created automatically based on the program prompts. Try/catch 2. Read TXT fileIdea 1:Get a file pathCreate a new
In the project you are working on, you may need to process multiple Excel output files, including csv, xls, and xlsx files, so I want to convert the last two methods to the csv format and parse them together. so I found the following two classes, both of which are official apache examples. source link:
XLS2CSV: html/api/org/apache/poi/hssf/eventusermodel/examples/XLS2CSVmra.java.html "> http://www.docjar.com/html/api/org/apache/poi/hssf/eventusermode
:{//determine if the cell is a date format if(dateutil.iscelldateformatted (cell)) {//Convert to date format Yyyy-mm-ddCellvalue =Cell.getdatecellvalue (); }Else{ //DigitalCellvalue =string.valueof (Cell.getnumericcellvalue ()); } Break; } Casecell.cell_type_string:{Cellvalue=Cell.getrichstringcellvalue (). getString (); Break; } default: Cellvalue= ""; } }Else{Cellvalue= ""; } returnCellvalue; }}Iv. Results
What is Phpexcel?Phpexcel is a PHP class library for working with Office Excel documents, based on the Microsoft OPENXML Standard and PHP language. You can use it to read and write spreadsheets in different formats, such as Excel (BIFF). xls, Excel (Officeopenxml). xlsx, CSV, Libre/openoffice Calc. ODS, Gnumeric, PDF , HTML, and so on. Download Phpexcelphpexcel's official website address is: http://phpexcel
When developing a business license management system in a place, you need to export data to Excel files. Although a year ago to do a group of ERP when used to import and export, but too busy at that time to write a blog, a year later I also forget about the same, so take advantage of today's use of this to write to the blog, As a future development of a reference, to avoid the need to use the time to export to find information, but also to other peers a reference. Author: dragondean, blog addres
Blog from: http://blog.csdn.net/amosryan/article/details/6568783
Function directory: Convert input stream to byte stream read the file as a string to specify the encoding format to place the input stream into a list
Source:[Java] View Plain copy print? packageamosryan.utility.file; importjava.io.bufferedreader; importjava.io.bytearrayoutputstream; importjava.io
Data export Excel files in the Asp.net|excel DataTable
Export data from a DataTable to a specified Excel file
public static void Export (System.Web.UI.Page page,system.data.datatable tab,string FileName)
{
System.Web.HttpResponse HttpResponse = page. Response;
System.Web.UI.WebControls.DataGrid datagrid=new System.Web.UI.WebControls.DataGrid ();
Datagrid.datasource=tab. DefaultView;
Datagrid.allowpaging = false;
DataGrid.HeaderStyle.BackColor = System
Use Case number(UI-0001)
Use case name({Verify page Jump | Validate element Text}-briefly Express)
validation type
Whether to perform
Initial URL
initial element XPath
Target Element XPath
Target element properties
Expected results
UI-0001
Verify page Jump-Login
Current tab page
Perform
http://www.yixun.com/
a[@id = ' j_login ')
0
0
Https://base.yixun.com/login.html
UI-0002
Verificati
My usual style, the code explains everything.
Nonsense not much said, directly to everyone to paste code, the specific code as follows:
Package Tools;
Import Java.io.BufferedWriter;
Import Java.io.File;
Import Java.io.FileWriter;
Import java.io.IOException;
Import Java.lang.reflect.Field;
Import java.util.ArrayList;
Import java.util.List; Import JXL.
Sheet; Import JXL.
workbook; Import entity.
Student; public class Convertxmstosql {/** * Gets the data from the
The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion;
products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the
content of the page makes you feel confusing, please write us an email, we will handle the problem
within 5 days after receiving your email.
If you find any instances of plagiarism from the community, please send an email to:
info-contact@alibabacloud.com
and provide relevant evidence. A staff member will contact you within 5 working days.