Add formatting to the cell in an Excel document
来源:互联网 发布:三菱fx 2n编程手册 编辑:程序博客网 时间:2024/05/22 20:38
Formatting Excel output from QuickTest Professional
You can use the Excel object model to automate formatting the values in a cell in an Excel worksheet.
Example:
filename = "C:\temp\Book1.xls"
Set ExcelObj = CreateObject("Excel.Application")
ExcelObj.Workbooks.Open filename
Set NewSheet = ExcelObj.Sheets.Item(1)
' Add the text - format bold
NewSheet.Cells(1,2) = "Hello From QTP!"
NewSheet.Cells(1,2).Font.Bold = true
' Add the text - format color
NewSheet.Cells(2,2) = "Hello From QTP!"
NewSheet.Cells(2,2).Font.Color = RGB(0, 0, 255)
' Add the text - format italic
NewSheet.Cells(3,2) = "Hello From QTP!"
NewSheet.Cells(3, 2).Font.Italic = true
' Add the text - format size
NewSheet.Cells(4,2) = "Hello From QTP!"
NewSheet.Cells(4, 2).Font.Size = 25
' Add the text - format Strikethrough
NewSheet.Cells(5,2) = "Hello From QTP!"
NewSheet.Cells(5, 2).Font.Strikethrough = true
' Add the text - format underline
NewSheet.Cells(6,2) = "Hello From QTP!"
NewSheet.Cells(6, 2).Font.Underline = true
' Add the text - format Subscript
NewSheet.Cells(7,2) = "1st test"
NewSheet.Cells(7, 2).Characters(2, 2).Font.Subscript = True
' Add the text - format Subscript
NewSheet.Cells(8,2) = "1st test"
NewSheet.Cells(8, 2).Characters(2, 2).Font.Superscript = True
ExcelObj.ActiveWorkbook.Save
ExcelObj.Application.Quit
Set ExcelObj = Nothing
0 0
- Add formatting to the cell in an Excel document
- Change the font and cell color in an Excel document
- Add cells, rows, or columns to an Excel document
- How to add an AJAX cart in the header in OpenCart
- Add text to an image in Java
- 转载:how to automate Microsoft Excel and return the values from a multi-cell range to an array
- Hide/display columns or rows in an Excel document
- Formatting AutoGenerateColumns in an ASP.NET Grid
- Serialization from an Object to XML Document in C#
- 错误 the type "xxxx" is defined in an assembly that is not refernced.You must add a reference to assem
- Saves an XML document to the specified location
- Add mappings to an Elasticsearch index in realtime
- How to Add An Automatically Executable Program in YOCTO?
- How to Find a Blank Cell in Excel Using Vba
- How to Create Cross-Cell Bar in Excel
- How To Add Menus to the Menubar in Cocoa
- How to Control the [Add document] button on the bottom of every view?
- How to create an Excel sheet or chart in VC?
- 黑马程序员-我的第十二篇学习日记:OC中空指针,野指针,僵尸对象,retain和release基本使用
- Change the font and cell color in an Excel document
- 爱不是逃避是努力
- 关于排序法的c++实例(一)
- 常用一些Java基础算法积累
- Add formatting to the cell in an Excel document
- PHP通过面向对象实现数据库备份
- Java封装自己的Api
- Word Search
- LED 流水灯闪烁
- java.sql.SQLException: Io 异常: The Network Adapter could not establish the connection可能问题之一
- 第六届SeedCoder比赛赛题_算法组
- 网站首页抓取和收录情况分析(个人见解)
- android Service 使用详细步骤(初学)