/** * Export FirstRow (Entitybean) list first row of data in the list EB, key-value pairs (not including ordinal) Example: ("name", "name") * data (entitybean[]) list * * @author ZHAOJQ */PUBL IC PR ExportData (entitybean eb) {if (EB = = null) {return new PR (0, "parameter is null", NULL);} try{//CREATE Table file String rootpath = Nameedpathutil.getdefaultsavepath (); String filepath = "/lsip/excel/"; File
Combine some information found on the Internet with your own example and write it down for your reference.
First, you must have a jxl. jar package. In. Then we found that jdk1.6 should use jexcelapi v2.6.9.
There is also a question that looks like the. XLSX file is not working properly, it can only be. xls.
The following is the demo of Excel File Import. It is necessary to import user information from useri
To do a background automation, to pre-generate a document, the following generated a document first download Jxl.jar package,: http://download.csdn.net/detail/prstaxy/44699351. Generate a simple Excel documentWritableworkbook Workbook =NULL; Try{Workbook= Workbook.createworkbook (NewFile ("F:\\test.xls")); //Create a new pageWritablesheet sheet = workbook.createsheet ("First sheet", 0); //create the specific content to displayLabel formate =NewLabel (
The example in this article describes how Java uses POI to read properties files and write to Excel. Share to everyone for your reference. The implementation method is as follows:
Package Com.hubberspot.code;
Import Java.io.File;
Import Java.io.FileInputStream;
Import java.io.FileNotFoundException;
Import Java.io.FileOutputStream;
Import java.io.IOException
. Write. Number (2, 1, 2.45, WCF );
Step 5: add the corresponding worksheet after the location is specified:
Sheet. addcell (writablecell)
Step 6: Write Data and close the output stream
WWB. Write ();
WWB. clost ();
Supplement: Write of Boolean value and date format:
Write method of Boolean value:
Jxl. Write. boolean flag = new jxl. Write. boolean (6, 1, true );Sheet. addcell (FLAG );
Write method in date format:
/*** Defines the public format of the display date.*
Given a positive integer, return its corresponding column title as appear in an Excel sheet.For example: 1, A 2, B 3, C ... AA, Z The essence is to change the 10 binary to 26, but note that the counting code from 1 starts as follows:public class Solution {public String converttotitle (int n) { String res= ""; while (n>0) { res= (char) ((n-1)%26+ ' A ') +res;
The example in this article describes the Java Operations method for Excel. Share to everyone for your reference. as follows:
Writableworkbook workbook = Workbook.createworkbook (new File ("D:\\output.xls"));
Writablesheet sheet = workbook.createsheet ("Project Briefing", 0);
Style Writablefont Sonti18font = new Writablefont (Writablefont.createfont ("X
Class C = Class.forName (Args[0]) at run time;//Enter COM.IMOOC in the Run configuration. Load class. excel//creates the class object through the class type ( Convert first to Word and Excel Common interface officeable) officeable OA = (officeable) c.newinstance (); Oa.start ();//not recommended for the following two kinds, Because you are not sure whether to load Word or
;
public class Officebetter {
/**
* @param args
*
/public static void main (string[] args) {
try {
/ /dynamic load class, at run time loaded class
C = Class.forName (Args[0]);//Enter COM.IMOOC in Run configuration. Load class. Excel
//Through the class type, create the class object ( First convert to Word and Excel's Common interface officeable)
officeable oa = (officeable) c.newinstance ();
Oa.start ();
The following tw
in the parameter when outputting the file:Note: If the path error, such as the deletion of a folder will be an error, as long as the error, even if the folder is set up will still report the directory error (as if there is memory function), then must be restarted Kettle to run correctly. l Use parameters and regular expressions to mix the scenes with the output file:Application of 1.1.3 kettle.properties parameters in Java codeUse variables in 1.1.4
Java Spring Loose coupling
The object-oriented concept is a good design to break the system into a group of reusable objects. However, when the system becomes larger, especially in Java projects, large object dependencies will always be tightly coupled to cause the object to be difficult to manage or modify. In this case, you can use the Spring framework as a core module to manage all object dependencies e
There has always been a recent exposure to programming principles or patterns such as the IoC (inversion of control, controlled inversion), DI (Dependency injection, Dependency injection), which is at the heart of the famous Java framework Spring, Struts, and so on. According to this check the Wikipedia entries, and from the library to borrow related books, read some understanding, now combined with the book of the explanation and their processing as
In Java, you can use the Stringtokennizer class to split a String into the different tokenas by defined delimiter. (Space is the default delimiter). Here ' re the StringTokennizer examples:Example 1Uses StringTokennizer to split a string by "space" and "comma" delimiter, and iterate the StringTokenizer elements and print it out O Ne by one. PackageCom.mkyong;ImportJava.util.StringTokenizer; Public classApp { Public Static voidMain (string[] args) {Str
View code
Package RegEx;Import java. Io. ioexception;Import java. util. RegEx. matcher;Import java. util. RegEx. pattern;/*** Note: matcher is the main operation class of the regular expression. It contains the most important method for extraction and replacement. pattern is not the main class.* Replaceall is used to replace all. replacefirst or replaceend can b
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.