http://social.msdn.microsoft.com/Forums/en-US/visualfoxprogeneral/thread/72575fea-a9f9-4c2e-856b-d2846dfdeb4b
oExcel = CreateObject("Excel.Application")
|
Create Object |
oSheet = oExcel.Activesheet |
Create Object |
|
|
oExcel.Sheets.Add |
Add a new worksheet |
oExcel.Workbooks.Add |
Add a new workbook |
oExcel.Range("A2:A3").Verticalalignment = 2 |
|
oExcel.Range("H2:N2").HorizontalAlignment = 3 |
Alignment, Center |
oExcel.Range(oExcel.Cells(mrow,mcol), oExcel.Cells(mrow,mcol)).HorizontalAlignment = 3 |
Alignment, Center |
oExcel.Range("H2:N2").HorizontalAlignment = 2 |
Alignment, Left |
oExcel.Cells(3,4).Horizontalalignment = 1 |
Alignment, Right |
oExcel.Columns("A:AD").Autofit |
Autofit |
oExcel.Activewindow.Displayworkbooktabs = -1 |
Book Tab |
oExcel.Activeworkbook.Close() |
Close |
oExcel.Cells(2,8).Interior.Colorindex = 6 |
Color, Background |
oExcel.Columns("C").ColumnWidth = 15 |
Column Width |
oExcel.Columns("C:H").ColumnWidth = 15 |
Column Width |
oExcel.Sheets("sheet1").Delete |
Delete Sheet |
oExcel.Displayalerts = 0 &&& or -1 |
Displayalerts Off |
oExcel.Cells(1,1).Font.Bold = 1 |
Font |
oExcel.Cells(1,1).Font.Colorindex = 55 |
Font Color |
oExcel.Cells(1,1).Font.Size = 16 |
Font Size |
oExcel.Columns("B:G").NumberFormatLocal = "0.00_ " |
Format : 2 Decimals |
oExcel.Columns("A:A").NumberFormatLocal = "[$-404]e/m/d;@" |
Format : Year |
oExcel.Activewindow.Freezepanes = -1 |
Freezepanes |
oExcel.Activewindow.Displaygridlines = -1 |
Gridline, Display |
oExcel.Activewindow.Displaygridlines = 0 |
Gridline, Hide |
oExcel.Range("B1").Entirecolumn.Insert |
Insert Column |
oExcel.Range("2:20").Entirerow.Insert |
Insert Row |
oExcel.Range("H2:N2").Borders.Linestyle = 1 |
Linestyle |
oExcel.Range("A2:B3").Merge |
Merge |
oExcel.Range(oExcel.Cells(mrow,mcol), oExcel.Cells(mrow,mcol)).Merge |
Merge |
oExcel.Activesheet.Name = "ABC" |
Name an Active Sheet |
oExcel.Activeworkbook.Open("ABC.xls") |
Open |
oExcel.Quit() |
Quit |
#Define XLDBF 8 |
Save Excel file as DBF file - step 1 |
oExcel.ActiveWorkbook.Saveas("ABC.dbf", XLDBF) |
Save Excel file as DBF file - step 2 |
oExcel.Activeworkbook.Saveas("ABC.xls") |
Saveas |
oExcel.Cells("A1").Select |
Select |
oExcel.Columns("B:E").Select |
Select |
oExcel.range("A9").Select |
Select |
oExcel.Selection.Copy |
Select and Copy |
oExcel.Selection.Cut |
Select and Cut |
oExcel.Selection.Paste |
Select and Paste |
oExcel.Sheets("sheet1").Select |
Select Sheet |
oExcel.Cells(1,1).Value = "ABC" |
Value, Assign a |
oExcel.Cells(mrow,mcol).Value = "ABC" |
Value, Assign a |
mValue=oExcel.Cells(mrow,mcol).Value |
Value, Return a |
oExcel.Visible = -1 |
Workbook Visible |
oExcel.Visible = 0 |
Workbook Invisible |
oExcel.Activewindow.DisplayZeros = .F. |
Zero Values, Hide All |
oExcel.Activewindow.Zoom = 70 |
Zoom |
Không có nhận xét nào:
Đăng nhận xét