wqweto / biff12writer Goto Github PK
View Code? Open in Web Editor NEWA VB6 library for consuming/producing BIFF12 (.xlsb) spreadsheets
License: MIT License
A VB6 library for consuming/producing BIFF12 (.xlsb) spreadsheets
License: MIT License
Is there a possibility to add more sheets and give a name for the sheet?
Sometimes i need more sheets inside the workbook.
Btw, as a workaround for the name i added it in the Init function and used this variable in Flush and it works,
but this cannot be done for multiple sheets...
Best regards, Mikel
hi wqweto:
I hope that the column width is less than 200 and it will not be saved. Now it is actually a blank column that is saved.
Is there a way to solve this? Thank you!
`Public Function Save2ExcelB(sFile As String, mGrid As MSHFlexGrid, lCols As Integer, lRows As Long) As Boolean
Dim oStyle() As cBiff12CellStyle
Dim lIdx As Long
Dim lRow As Long
Dim dblTimer As Single
Dim baBuffer() As Byte
Dim i As Integer
On Error GoTo EH
dblTimer = Timer
ReDim oStyle(0 To lCols) As cBiff12CellStyle
For lIdx = 0 To lCols - 1
Set oStyle(lIdx) = New cBiff12CellStyle
With oStyle(lIdx)
.FontName = "宋体"
.FontSize = 12 + lIdx
.Bold = False
End With
Next
oStyle(0).Bold = True
oStyle(0).HorAlign = ucsHalCenter
oStyle(0).VertAlign = ucsValMiddle
With New cBiff12Writer
'--- note: Excel's Biff12 clipboard reader cannot handle shared-strings table
.Init lCols, False, , "out"
For i = 0 To lCols - 1 ' MSHFlexGrid1.Cols - 1
.ColWidth(i) = mGrid.ColWidth(i) * 3
Next i
Dim j As Long
For lRow = 0 To lRows - 1
For lIdx = 0 To .ColCount - 1
'I hope that the column width is less than 200 and it will not be saved. Now it is actually a blank column that is saved.
If mGrid.ColWidth(lIdx) > 200 Then
.AddRow lRow, IIf(lRow = 18, 1000, 326)
.AddStringCell lIdx, mGrid.TextMatrix(lRow, lIdx), oStyle(0)
End If
Next
Next
.Flush
.SaveToFile baBuffer
WriteBinaryFile sFile, baBuffer
'GetForegroundWindow():在窗体中可以使用 me.hWnd,在模块中就要使用这个了。
If OpenClipboard(GetForegroundWindow()) = 0 Then Err.Raise vbObjectError, , "打开剪切板错误"
Call EmptyClipboard
SetTextData "Biff12 Explorer"
SetBinaryData AddFormat("Biff12"), baBuffer
Call CloseClipboard
End With
Save2ExcelB = True
'MsgBox "文件保存在: " & vbCrLf & vbCrLf & sFile & vbCrLf & vbCrLf & "耗时:" & Format$(Timer - dblTimer, "0.000") & "秒", 64
Exit Function
EH:
MsgBox Error & Err.Source, vbCritical, "Save2ExcelB"
End Function`
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.