这个是给某人做项目的时候写的。
原本是C#的,我改写成XXXXXT了,并且编译了一个dll。 --->>>>>>>>
Excel_Writer.rar
4.40KB
RAR
54次下载
<<<<<<<<---测试通过,很好用
原文地址
XXXXXXXXXXXXXXXXXXXt/jinjazz/archive/2008/08/01/XXXXXXXXXXpx调用方法:
Private Sub button1_Click_1(ByVal sender As Object, ByVal e As EventArgs)
Dim excel As New ExcelWriter("e:\test.xls")
XXXXXXXXginWrite excel.WriteString(0, 0, "1")
excel.WriteString(0, 1, "2")
excel.WriteString(1, 0, "3")
excel.WriteNumber(1, 1, 4)
excel.WriteNumber(2, 1, 5)
excel.EndWrite
End Sub
这个,要写多维数组到xls就简单了吧 = = 直接循环 嗯
下面是代码
Public Class Exel_Writer
Dim _r As XXXXXXXXXXXXleStream Public Function Init(ByVal strPath As String)
_r = New XXXXXXXXXXXXleStream(strPath, XXXXXXXXXXXXleMode.OpenOrCreate) Return Nothing
End Function
Public Sub BeginWrite()
Me._writeFile(New Short() {&H809, 8, 0, &H10, 0, 0})
End Sub
Private Function _writeFile(ByVal values As Short())
Dim v As Short
For Each v In values
Dim b As Byte() = XXXXXXXXXXXXXXXtBytes(v) Me._r.Write(b, 0, b.Length)
Next
Return Nothing
End Function
Public Function EndWrite()
Dim CS As Short() = New Short(2 - 1) {}
CS(0) = 10
Me._writeFile(CS)
Me._XXXXose() Return Nothing
End Function
Public Function WriteNumber(ByVal x As Short, ByVal y As Short, ByVal value As Double)
Dim CS As Short() = New Short(5 - 1) {}
CS(0) = &H203
CS(1) = 14
CS(2) = x
CS(3) = y
Me._writeFile(CS)
Dim b As Byte() = XXXXXXXXXXXXXXXtBytes(value) Me._r.Write(b, 0, b.Length)
Return Nothing
End Function
Public Function WriteString(ByVal x As Short, ByVal y As Short, ByVal value As String)
Dim b As Byte() = XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXtBytes(value) Dim CS As Short() = New Short(6 - 1) {}
CS(0) = &H204
CS(1) = CShort((b.Length + 8))
CS(2) = x
CS(3) = y
CS(5) = CShort(b.Length)
Me._writeFile(CS)
Me._r.Write(b, 0, b.Length)
Return Nothing
End Function
End Class
附:原C#代码
200字以内,仅用于支线交流,主线讨论请采用回复功能。