jxl Operation excel (merged cells, set the background color, font color)

The project is being done now involves a large number of Excel files export import operations are using the Java Excel to operate.

Java Excel is an open source project, through which Java developers can read Excel document, create a new Excel file, update an existing Excel file. Now, I wrote a simple example to show the basic reading, new, update (including the common format settings: font, color, background, merged cells), copy operations, these in fact sufficient to meet the most basic question . The following are cases of the source code:

import java.io. *;
import java.util.Date;
import jxl .*;
import jxl.format.Colour;
import jxl.format.UnderlineStyle;
import jxl.read.biff.BiffException;
import jxl.write .*;
import jxl.format.UnderlineStyle;
import jxl.format.CellFormat;;

public class OperateExcel (

/ **
* Read data from a excel file
* /
public static void readExcel (String excelFileName) (
Workbook rwb = null;
try (
InputStream stream = new FileInputStream (excelFileName);
rwb = Workbook.getWorkbook (stream);
Sheet sheet = rwb.getSheet (0);
Cell cell = null;
int columns = sheet.getColumns ();
int rows = sheet.getRows ();
for (int i = 0; i <rows; i + +)
for (int j = 0; j <columns; j + +) (
/ / attention: The first parameter is column, the second parameter is row.
cell = sheet.getCell (j, i);
String str00 = cell.getContents ();
if (cell.getType () == CellType.LABEL)
str00 + = "LAEBL";
else if (cell.getType () == CellType.NUMBER)
str00 + = "number";
else if (cell.getType () == CellType.DATE)
str00 + = "date";
System.out.println ( "00 ==>"+ str00);
)
stream.close ();
)
catch (IOException e) (
e.printStackTrace ();
)
catch (BiffException e) (
e.printStackTrace ();
)
finally (
rwb.close ();
)
)
/ **
* Create a new excelFile
* @ Param excelFileName create name
* /
public static void createExcelFile (String excelFileName) (
try (
WritableWorkbook wwb = Workbook.createWorkbook (new File (excelFileName));
WritableSheet ws = wwb.createSheet ( "sheet1", 0);
/ / also, The first parameter is column, the second parameter is row.
/ / Add normal label data
Label label00 = new Label (0,0, "Label00");
ws.addCell (label00);
/ / add font formating data
WritableFont wf = new WritableFont (WritableFont.TIMES, 18, WritableFont.BOLD, true);
WritableCellFormat wff = new WritableCellFormat (wf);
Label label10 = new Label (1,0, "Label10", wff);
ws.addCell (label10);
/ / add color font formating data
WritableFont wf_color = new WritableFont (WritableFont.ARIAL, 10, WritableFont.NO_BOLD, false, UnderlineStyle.DOUBLE_ACCOUNTING, Colour.RED);
WritableCellFormat wff_color = new WritableCellFormat (wf_color);
wff_color.setBackground (Colour.GRAY_25); / / set background coloe to gray
Label label20 = new Label (2,0, "Label20", wff_color);
ws.addCell (label20);

/ / Merge Cells
WritableFont wf_merge = new WritableFont (WritableFont.ARIAL, 10, WritableFont.NO_BOLD, false, UnderlineStyle.DOUBLE_ACCOUNTING, Colour.GREEN);
WritableCellFormat wff_merge = new WritableCellFormat (wf_merge);
wff_merge.setBackground (Colour.BLACK);
Label label30 = new Label (3,0, "Label30", wff_merge);
ws.addCell (label30);
Label label40 = new Label (4,0, "Label40");
ws.addCell (label40);
Label label50 = new Label (5,0, "Label50");
ws.addCell (label50);
/ / Merge (0,3) (4,0)
/ / attention: if the merger behind the column is not empty, then put back the contents of the empty cell, the format is according to the format of the previous cell
ws.mergeCells (3,0,4,0);

/ / Add the Number format data
jxl.write.Number labelN = new jxl.write.Number (0, 1, 3.1415926);
ws.addCell (labelN);

/ / Add a Number object with the formatting
jxl.write.NumberFormat nf = new jxl.write.NumberFormat ("#.##");
jxl.write.WritableCellFormat wcfN = new jxl.write.WritableCellFormat (nf);
jxl.write.Number labelNF = new jxl.write.Number (1, 1, 3.1415926, wcfN);
ws.addCell (labelNF);

/ / Add the Boolean Object
jxl.write.Boolean labelBoolean = new jxl.write.Boolean (2,1, false);
ws.addCell (labelBoolean);

/ / Add a DateTime object
DateTime labelDT = new DateTime (3,1, new Date ());
ws.addCell (labelDT);

/ / Add the data with the format DataTime
DateFormat dtf = new DateFormat ( "yyyy-MM-dd hh: mm: ss");
WritableCellFormat wcfDt = new WritableCellFormat (dtf);
wcfDt.setBackground (Colour.YELLOW);
DateTime labelDT_format = new DateTime (4,1, new java.util.Date (), wcfDt);
ws.addCell (labelDT_format);
ws.mergeCells (4,1,5,1); / / longer, use two columns to display

wwb.write ();
wwb.close ();
)
catch (IOException e) (
e.printStackTrace ();
)
catch (WriteException e) (
e.printStackTrace ();
)
)
/ **
* How to update Excel files
* @ Param fileName
* /
public static void updateExcel (String fileName) (
try (
jxl.Workbook rw = jxl.Workbook.getWorkbook (new File (fileName));
WritableWorkbook wwb = Workbook.createWorkbook (new File (fileName), rw);
/ / Here is a copy in fact the implementation of operation, first read the document in memory, modify and then save the file to overwrite the original update operation to achieve
WritableSheet ws = wwb.getSheet (0);
WritableCell wc = ws.getWritableCell (0,0);
if (wc.getType () == CellType.LABEL) (
Label l = (Label) wc;
l.setString (wc.getContents ()+"_ new ");
)
wwb.write ();
wwb.close ();
)
catch (IOException e) (
e.printStackTrace ();
)
catch (WriteException e) (
e.printStackTrace ();
)
catch (BiffException e) (
e.printStackTrace ();
)
)
/ **
* How to copy Excel file
* @ Param fileName
* /
public static void copyExcel (String sourFileName, String destFileName) (
try (
jxl.Workbook rw = jxl.Workbook.getWorkbook (new File (sourFileName));
WritableWorkbook wwb = Workbook.createWorkbook (new File (destFileName), rw);
wwb.write ();
wwb.close ();
)
catch (IOException e) (
e.printStackTrace ();
)
catch (WriteException e) (
e.printStackTrace ();
)
catch (BiffException e) (
e.printStackTrace ();
)
)

public static void main (String [] argv) (
/ / OperateExcel.readExcel ( "E: \ \ test.xls");
/ / OperateExcel.createExcelFile ( "E: \ \ test1.xls");
/ / OperateExcel.updateExcel ( "E: \ \ test.xls");
OperateExcel.copyExcel ( "E: \ \ test.xls", "E: \ \ moon.xls");
)

)

jxl read and write excel common operations has collected (reproduced) (2008-10-29 22:53:01)
Tags: jxl excel Zatan Category: java

jxl read and write excel common operations has collected 2008-04-23 17:26 package common.excelTool;

import java.io.File;
import java.io.FileOutputStream;
import java.io.OutputStream;
import java.util.ArrayList;
import java.util.Date;
import java.util.HashMap;

import jxl.Cell;
import jxl.CellType;
import jxl.DateCell;
import jxl.Range;
import jxl.Sheet;
import jxl.Workbook;
import jxl.WorkbookSettings;
import jxl.format.Alignment;
import jxl.format.Border;
import jxl.format.BorderLineStyle;
import jxl.format.CellFormat;
import jxl.format.Colour;
import jxl.format.UnderlineStyle;
import jxl.format.VerticalAlignment;
import jxl.write.Formula;
import jxl.write.Label;
import jxl.write.Number;
import jxl.write.NumberFormat;
import jxl.write.WritableCell;
import jxl.write.WritableCellFeatures;
import jxl.write.WritableCellFormat;
import jxl.write.WritableFont;
import jxl.write.WritableSheet;
import jxl.write.WritableWorkbook;
import jxl.write.WriteException;
import jxl.write.biff.RowsExceededException;

public class WriteExcelTest (
static HashMap map = new HashMap ();

public static void main (String [] args) (
try (
/ / CopyDateFormat (new File ( "c: \ \ a.xls"), 0, "c: \ \ copy of a.xls");
/ / WriteExcelUseFormat ( "c: \ \ format.xls", "test");

/ / BuildNewFormTemplete (new File ( "c: / templete.xls"), new File ( "c: / buildNewFormTemplete.xls"));
/ / ModifyDirectly1 (new File ( "c: / templete.xls"));
/ / ModifyDirectly2 (new File ( "c: / templete.xls"));
copyDateAndFormat (new File ( "c: / a.xls"), 0, "c: / a2.xls");
) Catch (Exception e) (
/ / TODO Auto-generated catch block
e.printStackTrace ();
)
)

public static void modifyDirectly2 (File inputFile) throws Exception (
Workbook w1 = Workbook.getWorkbook (inputFile);
WritableWorkbook w2 = Workbook.createWorkbook (inputFile, w1);
WritableSheet sheet = w2.getSheet (0);

WritableCell cell = null;
CellFormat cf = null;

/ / Bold
cell = sheet.getWritableCell (0,0);
WritableFont bold = new WritableFont (WritableFont.ARIAL,
WritableFont.DEFAULT_POINT_SIZE,
WritableFont.BOLD);
cf = new WritableCellFormat (bold);
cell.setCellFormat (cf);

/ / Set Underline
cell = sheet.getWritableCell (0,1);
WritableFont underline = new WritableFont (WritableFont.ARIAL,
WritableFont.DEFAULT_POINT_SIZE,
WritableFont.NO_BOLD,
false,
UnderlineStyle.SINGLE);
cf = new WritableCellFormat (underline);
cell.setCellFormat (cf);

/ / Straight forward to add you can override
setCellValueDirectly (sheet, sheet.getCell (0, 2), new Double (4), CellType.NUMBER);

w2.write ();
w2.close ();
)

public static void modifyDirectly1 (File file) (
try (
/ / Excel access to documents
Workbook wb = Workbook.getWorkbook (file);
/ / Open a file copy, and specify the data to write back to the original document
WritableWorkbook book = Workbook.createWorkbook (file,
wb);
WritableSheet sheet0 = book.getSheet (0);
sheet0.addCell (new Label (0, 1, "Chen Wen"));

/ / Add a worksheet
WritableSheet sheet = book.createSheet ( "second page", 1);
sheet.addCell (new Label (0, 0, "the second page of the test data"));
book.write ();
book.close ();
) Catch (Exception e) (
System.out.println (e);
)
)

public static void buildNewFormTemplete (File inputFile, File outputFile) (
try (
/ / Excel access to documents
Workbook wb = Workbook.getWorkbook (inputFile);
/ / Open a file copy, and specify the data to write back to the original document
WritableWorkbook book = Workbook.createWorkbook (outputFile,
wb);
WritableSheet sheet0 = book.getSheet (0);
sheet0.addCell (new Label (0, 1, "Chen Wen"));

/ / Add a worksheet
WritableSheet sheet = book.createSheet ( "second page", 1);
sheet.addCell (new Label (0, 0, "the second page of the test data"));

book.write ();
book.close ();
) Catch (Exception e) (
System.out.println (e);
)
)

public static void copyDateAndFormat (File inputFile, int inputFileSheetIndex, String outputFilePath) throws Exception (
Workbook book = null;
Cell cell = null;
/ / 1. To avoid garbled settings
WorkbookSettings setting = new WorkbookSettings ();
java.util.Locale locale = new java.util.Locale ( "zh", "CN");
setting.setLocale (locale);
setting.setEncoding ( "ISO-8859-1");
book = Workbook.getWorkbook (inputFile, setting);
Sheet readonlySheet = book.getSheet (inputFileSheetIndex);

OutputStream os = new FileOutputStream (outputFilePath); / / output Excel file URL
WritableWorkbook wwb = Workbook.createWorkbook (os); / / create a writable workbook
WritableSheet writableSheet = wwb.createSheet (readonlySheet.getName (), 0); / / create a worksheet to write

/ / 2. Transcription of data in different data formats
for (int rowIndex = 0; rowIndex <readonlySheet.getRows (); rowIndex + +) (
for (int colIndex = 0; colIndex <readonlySheet.getColumns (); colIndex + +) (
cell = readonlySheet.getCell (colIndex, rowIndex);
/ / A2B2 cells for the merger, A2 have content, B2 is empty
/ / If (colIndex == 0 & & rowIndex == 1) (
/ / System.out.println (colIndex + "," + rowIndex + "type:" + cell.getType () + ":" + cell.getContents ());
/ /)

/ / There are various formatting 【】
if (cell.getType () == CellType.DATE | | cell.getType () == CellType.DATE_FORMULA) (
writableSheet.addCell (
new jxl.write.DateTime (
colIndex
, RowIndex
, ((DateCell) cell). GetDate (),
new jxl.write.WritableCellFormat (
cell.getCellFormat ()
)
)
);
) else if (cell.getType () == CellType.NUMBER | | cell.getType () == CellType.NUMBER_FORMULA) (
writableSheet.addCell (
new jxl.write.Number (
colIndex
, RowIndex
, ((Jxl.NumberCell) cell). GetValue (),
new jxl.write.WritableCellFormat (
cell.getCellFormat ()
)
)
);
) else if (cell.getType () == CellType.EMPTY) (
/ / Empty, as well as merged cell outside of the first column
/ / System.out.println ( "EMPTY:" + cell.getContents ());
/ / System.err.println ( "empty cells at" + colIndex + "," + rowIndex + "content:" + cell.getContents ());
) else if (cell.getType () == CellType.LABEL | | cell.getType () == CellType.STRING_FORMULA) (
writableSheet.addCell (
new Label (
colIndex
, RowIndex
, Cell.getContents ()
, New jxl.write.WritableCellFormat (
cell.getCellFormat ()
)
)
);
) else (
System.err.println ( "other cell types:" + cell.getType () + "at" + colIndex + "," + rowIndex + "content:" + cell.getContents ());
)

/ / If (cell.getType () == CellType.STRING_FORMULA) (
/ / System.err.println (colIndex + "," + rowIndex + ":" + cell.getContents () + "type:" + cell.getType ());
/ /)
)
)

/ / 3. Dealing with merged cells do (copy merged cell format)
Range [] range = readonlySheet.getMergedCells ();
for (int i = 0; i <range.length; i + +) (
/ / System.out.println ( "No." + i + "The merger of the cell:"
/ / + ", GetTopLeft =" + range [i]. GetTopLeft (). GetColumn ()
/ / +","+ Range [i]. GetTopLeft (). GetRow ()
/ / + ", GetBottomRight =" + range [i]. GetBottomRight (). GetColumn ()
/ / +","+ Range [i]. GetBottomRight (). GetRow ()
/ /);
/ / topleftXIndex, topleftYIndex, bottomRightXIndex, bottomRightYIndex
writableSheet.mergeCells (
range [i]. getTopLeft (). getColumn (),
range [i]. getTopLeft (). getRow (),
range [i]. getBottomRight (). getColumn (),
range [i]. getBottomRight (). getRow ()
);
)

/ / 4. Set the ranks of height to width
for (int colIndex = 0; colIndex <readonlySheet.getColumns (); colIndex + +) (
writableSheet.setColumnView (colIndex, readonlySheet.getColumnView (colIndex));
)
for (int rowIndex = 0; rowIndex <readonlySheet.getRows (); rowIndex + +) (
writableSheet.setRowView (rowIndex, readonlySheet.getRowView (rowIndex));
)

wwb.write ();
wwb.close ();
os.close ();
)

public static void writeExcelUseFormat (String outputFilePath, String outputFileSheetName) throws Exception (
OutputStream os = new FileOutputStream (outputFilePath); / / output Excel file URL
WritableWorkbook wwb = Workbook.createWorkbook (os); / / create a writable workbook
WritableSheet sheet = wwb.createSheet (outputFileSheetName, 0); / / create a worksheet to write

sheet.addCell (new Label (0, 0, "Number"));
sheet.addCell (new Label (1, 0, "Term"));

/ / 1. The time write data format
jxl.write.DateFormat df = new jxl.write.DateFormat ( "yyyy-MM-dd");
jxl.write.WritableCellFormat wcfDF = new jxl.write.WritableCellFormat (df);
jxl.write.DateTime labelDTF = new jxl.write.DateTime (1, 1, new Date (), wcfDF); / / custom format
sheet.addCell (labelDTF);

/ / 2. Font Style
/ / WritableFont () method where parameter description:
/ / This method is regarded as a container, you can go into a lot of properties
/ / The first one: TIMES is the font size, he wrote that the 18
/ / Second: BOLD is to determine whether the italic, select the true italics when
/ / Third: ARIAL
/ / Fourth: UnderlineStyle.NO_UNDERLINE Underline
/ / Fifth: jxl.format.Colour.RED font color is red
jxl.write.WritableFont wf = new jxl.write.WritableFont (WritableFont.TIMES, 18, WritableFont.BOLD, true);
jxl.write.WritableCellFormat wcfF = new jxl.write.WritableCellFormat (wf);
wcfF.setWrap (true); / / wrap
wcfF.setAlignment (jxl.format.Alignment.CENTRE); / / to the level of alignment is designated as the middle
wcfF.setVerticalAlignment (jxl.format.VerticalAlignment.CENTRE); / / the vertical alignment of the center is designated as
jxl.write.Label labelC = new jxl.write.Label (0, 1, "This is a Label cell", wcfF);
sheet.addCell (labelC);

/ / 3. Add a Number object with the formatting
jxl.write.NumberFormat nf = new jxl.write.NumberFormat ("#.##");
jxl.write.WritableCellFormat wcfN = new jxl.write.WritableCellFormat (nf);
jxl.write.Number labelNF = new jxl.write.Number (0, 2, 3.1415926, wcfN);
sheet.addCell (labelNF);

/ / 4. Add a Boolean object
jxl.write.Boolean labelB = new jxl.write.Boolean (0, 3, false);
sheet.addCell (labelB);

/ / 5. To set an annotation
WritableCellFeatures cellFeatures = new WritableCellFeatures ();
cellFeatures.setComment ( "Add a Boolean object");
labelB.setCellFeatures (cellFeatures);

/ / 6. Wrap inside cell
WritableCellFormat wrappedText = new WritableCellFormat
(WritableWorkbook.ARIAL_10_PT);
wrappedText.setWrap (true); / / available-for-line label style
Label label = new Label (4, 0, "test, \ 012 test 。。。", wrappedText); / /" \ 012 "forced line break
sheet.addCell (label);

/ / 7. Numbers formula
Number n = new jxl.write.Number (0,9,4.5); / / A10
sheet.addCell (n);
n = new Number (1,9,; / / B10
sheet.addCell (n);
NumberFormat dp3 = new NumberFormat ("#.###"); / / set the cell inside a digital format
WritableCellFormat dp3cell = new WritableCellFormat (dp3);
dp3cell.setWrap (true);
Formula f = new Formula (2, 9, "(a10 + b10) / 2", dp3cell); / / set the C10 formula
sheet.addCell (f);
f = new Formula (3, 9, "SUM (A10: B10)", dp3cell); / / set the D10 formula
sheet.addCell (f);

/ / 8. To set the style sheet
sheet.getSettings (). setProtected (true); / / Set xls protection of the cell for the read-only
sheet.getSettings (). setPassword ( "123"); / / Set the password xls
sheet.getSettings (). setDefaultColumnWidth (10); / / set the default column width, 2cm or so
sheet.setRowView (3,200); / / set the row height of 4
sheet.setRowView (2, false); / / This will automatically expand the row height
sheet.setColumnView (0, 300); / / set column 1 width, 6cm or so
sheet.mergeCells (0, 5, 1, 7); / / Merge Cells: The combined A6B8 is a six rows and seven rows between the two rectangular

/ / 9. Set Border
drawRect (sheet, 5, 6, 7, 6, BorderLineStyle.THICK, Colour.BLACK, null);

wwb.write ();
wwb.close ();
os.close ();
)

public static void drawRect (WritableSheet sheet, int x, int y, int width, int height, BorderLineStyle style, Colour BorderColor, Colour bgColor) throws WriteException (
for (int w = 0; w <width; w + +) (
for (int h = 0; h <height; h + +) (
WritableCellFormat alignStyle = new WritableCellFormat (); / / cell style
alignStyle.setAlignment (Alignment.CENTRE); / / Set alignment
alignStyle.setVerticalAlignment (VerticalAlignment.CENTRE); / / Set alignment
if (h == 0) / / draw
alignStyle.setBorder (Border.TOP, style, BorderColor); / / set the border color and style

if (w == 0) / / draw left
alignStyle.setBorder (Border.LEFT, style, BorderColor); / / set the border color and style

if (w == width - 1) / / draw the right
alignStyle.setBorder (Border.RIGHT, style, BorderColor); / / set the border color and style

if (h == height -1) / / paint
alignStyle.setBorder (Border.BOTTOM, style, BorderColor); / / set the border color and style
/ / drawLine (sheet, x, y, Border.BOTTOM);
if (bgColor! = null)
alignStyle.setBackground (bgColor); / / Beijing Color
Label mergelabel = new Label (x, y, "", alignStyle);
/ / topleftXIndex, topleftYIndex, bottomRightXIndex, bottomRightYIndex
/ / sheet.mergeCells (2, 5, 10, 10);
sheet.addCell (mergelabel);
y + +;
)
y -= height;
x + +;
)
)

public static ArrayList <String> sampleReadExcel (File inputFile, int inputFileSheetIndex) throws Exception (
ArrayList <String> list = new ArrayList <String> ();
Workbook book = null;
Cell cell = null;
/ / Set to avoid the garbled
WorkbookSettings setting = new WorkbookSettings ();
java.util.Locale locale = new java.util.Locale ( "zh", "CN");
setting.setLocale (locale);
setting.setEncoding ( "ISO-8859-1");
book = Workbook.getWorkbook (inputFile, setting);

Sheet sheet = book.getSheet (inputFileSheetIndex);
for (int rowIndex = 0; rowIndex <sheet.getRows (); rowIndex + +) (/ / Excel first acts of the table header, so set an initial value J
for (int colIndex = 0; colIndex <sheet.getColumns (); colIndex + +) (/ / only remove 2 from Excel
cell = sheet.getCell (colIndex, rowIndex);
list.add (cell.getContents ());
)
)

/ / 【Question: If the actual time of deployment did not write the following phrase would lead to a constant drain on the server's memory? jxl which have not closed ReadWrite.java read, only written in closed】
book.close ();

return list;
)

public static void setCellValueDirectly (WritableSheet sheet, Cell cell, Object newValue, CellType type) throws Exception (
if (type == CellType.DATE | | type == CellType.DATE_FORMULA) (
sheet.addCell (
new jxl.write.DateTime (
cell.getColumn ()
, Cell.getRow ()
, (Date) newValue,
new jxl.write.WritableCellFormat (
cell.getCellFormat ()
)
)
);
) else if (type == CellType.NUMBER | | type == CellType.NUMBER_FORMULA) (
sheet.addCell (
new jxl.write.Number (
cell.getColumn ()
, Cell.getRow ()
, ((Double) newValue). DoubleValue (),
new jxl.write.WritableCellFormat (
cell.getCellFormat ()
)
)
);
) else if (type == CellType.LABEL | | type == CellType.STRING_FORMULA) (
sheet.addCell (
new Label (
cell.getColumn ()
, Cell.getRow ()
, (String) newValue
, New jxl.write.WritableCellFormat (
cell.getCellFormat ()
)
)
);
) else (
throw new Exception ( "not supported by other cell types:" + type);
/ / System.err.println ( "not supported by other cell types:" + cell.getType () + "at" + cell.getColumn () + "," + cell.getRow () + "current content:" + cell.getContents ());
)
)

Custom color settings
  • del.icio.us
  • StumbleUpon
  • Digg
  • TwitThis
  • Mixx
  • Technorati
  • Facebook
  • NewsVine
  • Reddit
  • Google
  • LinkedIn
  • YahooMyWeb
Tags:

Related Posts of jxl Operation excel (merged cells, set the background color, font color)

  • Very nice web page information ToolTips mouse tips

    <style> . TableBorder7 (width: 800; solid; background-color: # 000000;) TD (font-family: Arial; font-size: 12px; line-height: 15px;) th (background-color: # f7f7f7; color: # 000000; font-size: 12px; font-weight: bold;) th.th1 (background-color: ...

  • continuous vertical scrolling text div

    <div"Height:200;overflow:hidden;background-color:#cccccc;" defaultSpeed=2 tempSpeed=2> <div> <font color=red> Content 1 </ font> <br> <font color=blue> Content 2 </ font> <br> <font color=black

  • No access to materials based on material properties

    SPAN {font-family: "Courier New"; font-size: 10pt; color: # 000000; background: # FFFFFF;}. L1S31 {font-style: italic; color: # 808080;}. L1S32 {color: # 3399FF ;}. L1S33 {color: # 4DA619;}. L1S52 {color: # 0000FF;} FORM frm_search_objects. TRAN

  • css javascript operation

    <html> <head> <title> dynamically change text color </ title> <style type="text/css"> body (background-color: pink; font-size: 22pt; font-weight: bold; ) . Red (color: rgb (255,0,0); font-style: italic; font-si

  • Android TextView font color changes follow the focus

    We usually need to select an item in the ListView, his font color, and not the same as the original, so you can distinguish. How to set the font color? TextColor in the layout file to set a color, but not only set a color, but under different conditi

  • listbox set your own

    SPAN {font-family: "Courier New"; font-size: 10pt; color: # 000000; background: # FFFFFF;}. L1S32 {color: # 3399FF;}. L1S33 {color: # 4DA619;}. L1S52 {color : # 0000FF;} parameters: p_sort (40) type c obligatory as listbox visible length 40

  • Android List Background and item Background

    To make ListVIew more attractive, we can set the background color and Item his background color, the adapter getView () set the background color, to use the view.setBackgroundColor (getRsoures (). GetColor (R.id.color.XXX )) to set the color, if used

  • Note 2 --- css learning

    Main properties: foreground color, background color, background-color <html> <head> <title> css example - the color and background </ title> <style type="text/css"> h1 ( color: # FF0066; background-color: blue;

  • Div + CSS rules of order of 4 - Background background of some of the syntax ~ [update]

    15, some grammar background background background-image: url (background pattern. jpg, gif, bmp); background-color: # FFFFFF; (background color) background-color: transparent; <- set the background for the transparent color -> background-repeat ...

  • Recommended three so-called "top" CSS skills!

    First, a single line statement CSS Example Source Code [www.52css.com] h2 (font-size: 18px; border: 1px solid blue; color: # 000; background-color: # FFF;) h2 ( font-size: 18px; border: 1px solid blue; color: # 000; background-color: # FFF; ) The sec

blog comments powered by Disqus
Recent
Recent Entries
Tag Cloud
Random Entries