Giter VIP home page Giter VIP logo

biff12writer's Introduction

biff12writer's People

Contributors

jpbro avatar mikel3361 avatar wqweto avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar

biff12writer's Issues

Multiple sheets and possibility to give a sheet name

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

Output zero width columns (was: About saving column blanks)

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`

Biff12Writer.zip

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.