首页 诗词 字典 板报 句子 名言 友答 励志 学校 网站地图
当前位置: 首页 > 教程频道 > 开发语言 > PB >

pb控制写入到excel的字体解决办法

2012-02-16 
pb控制写入到excel的字体在pb中通过ole控件插入了一个excel表格,在对表格操作的时候需要对一格写入多行,而

pb控制写入到excel的字体
在pb中通过ole控件插入了一个excel表格,在对表格操作的时候需要对一格写入多行,而且是不同的字体,
比如在cells(1,1)先写入123,为Arial的,再另起一行,但还是cells(1,1)中,再写入345,为Simsun的,
请问要怎么操作呢

[解决办法]
手工在excel里改,录制成宏,编辑录制的宏把代码复制出来
参照宏代码在pb里ole_xxx.object.xxxxx来写,多试几次就出来了
[解决办法]
 31.设置字体

  eole.ActiveSheet.Cells(2,1).Font.Name=″黑体″

  32.设置字体大小

  eole.ActiveSheet.Cells(1,1).Font.Size=25

  33.设置字体为斜体

  eole.ActiveSheet.Cells(1,1).Font.Italic=.t.

  34.设置整列字体为粗体

  eole.ActiveSheet.Columns(1).Font.Bold=.t.

  35.清除单元格公式


[解决办法]
试试这么写行不?
eole.ActiveSheet.Cells(1,1).Characters(Start:=1, Length:=1).Font.colorindex=3

//以下是我录制的宏,
Range("C5").Select
ActiveCell.FormulaR1C1 = "a" & Chr(10) & "b" & Chr(10) & "c"
With ActiveCell.Characters(Start:=1, Length:=1).Font
.Name = "宋体"
.FontStyle = "常规"
.Size = 12
.Strikethrough = False
.Superscript = False
.Subscript = False
.OutlineFont = False
.Shadow = False
.Underline = xlUnderlineStyleNone
.ColorIndex = 3
End With
With ActiveCell.Characters(Start:=2, Length:=1).Font
.Name = "宋体"
.FontStyle = "常规"
.Size = 12
.Strikethrough = False
.Superscript = False
.Subscript = False
.OutlineFont = False
.Shadow = False
.Underline = xlUnderlineStyleNone
.ColorIndex = xlAutomatic
End With
With ActiveCell.Characters(Start:=3, Length:=1).Font
.Name = "宋体"
.FontStyle = "常规"
.Size = 12
.Strikethrough = False
.Superscript = False
.Subscript = False
.OutlineFont = False
.Shadow = False
.Underline = xlUnderlineStyleNone
.ColorIndex = 50
End With
With ActiveCell.Characters(Start:=4, Length:=1).Font
.Name = "宋体"
.FontStyle = "常规"
.Size = 12
.Strikethrough = False
.Superscript = False
.Subscript = False
.OutlineFont = False
.Shadow = False
.Underline = xlUnderlineStyleNone
.ColorIndex = xlAutomatic
End With
With ActiveCell.Characters(Start:=5, Length:=1).Font
.Name = "宋体"
.FontStyle = "常规"
.Size = 12
.Strikethrough = False
.Superscript = False
.Subscript = False
.OutlineFont = False
.Shadow = False
.Underline = xlUnderlineStyleNone
.ColorIndex = 5
End With
Range("C3").Select
[解决办法]
宏语句在PB里好像不能完全识别的啊 
 就是

热点排行