顯示具有 FpSpread 標籤的文章。 顯示所有文章
顯示具有 FpSpread 標籤的文章。 顯示所有文章

2019年4月10日 星期三

[GrapeCity][Spread Windows Forms] combine sheet to one PDF 實作合併sheet 匯出一個PDF檔案




'單一FPSpread

    Public Sub CombinePDFFiles()
        Dim printset As FarPoint.Win.Spread.PrintInfo = New FarPoint.Win.Spread.PrintInfo()
        printset.PrintToPdf = True
        printset.PdfWriteMode = PdfWriteMode.Append
        printset.PdfFileName = "D:\TEST\testPDF_" & Format(Now, "yyyyMMddHHmmss") & ".pdf"

        FpSpread1.Sheets(0).PrintInfo = printset
        FpSpread1.Sheets(1).PrintInfo = printset
        FpSpread1.Sheets(2).PrintInfo = printset

        FpSpread1.PrintSheet(-1)
    End Sub


原本希望將多個FPSpread 直接合併匯出一個PDF檔案,實測後是不支援的
所以比較好的做法是直接將兩個檔案合併到同一個FPSpread中




'多個FPSpread

    Public Sub CombinePDFFiles()
        Dim Spread As FarPoint.Win.Spread.FpSpread = New FarPoint.Win.Spread.FpSpread()
        Spread.BringToFront()

        Spread.Size = New System.Drawing.Size(600, 300)
        Spread.Anchor = CType((System.Windows.Forms.AnchorStyles.Top Or System.Windows.Forms.AnchorStyles.Left), System.Windows.Forms.AnchorStyles)
        Dim coll As FarPoint.Win.Spread.SheetViewCollection
        coll = Spread.Sheets
        coll.Add(FpSpread1.Sheets(0))
        coll.Add(FpSpread2.Sheets(0))

        Dim printset As FarPoint.Win.Spread.PrintInfo = New FarPoint.Win.Spread.PrintInfo()
        printset.PrintToPdf = True
        printset.PdfWriteMode = PdfWriteMode.Append

        printset.PdfFileName = "D:\TEST\testPDF_" & Format(Now, "yyyyMMddHHmmss") & ".pdf"

        Me.Controls.Add(Spread)
        Spread.Sheets(0).PrintInfo = printset
        Spread.Sheets(1).PrintInfo = printset
        Spread.PrintSheet(-1)


    End Sub


這方法也是可行,但我覺得如果設計成自動產生會造成元件的負擔
應該蠻容易crash的


程式碼

2017年9月29日 星期五

[GrapeCity][Spread Windows Forms] 錯誤 Task could not find "LC.exe" using the SdkToolsPath ""






錯誤訊息(Error):
Task could not find "LC.exe" using the SdkToolsPath "" or the registry key "HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Microsoft SDKs\NETFXSDK\4.6.1\WinSDK-NetFx40Tools-x86". Make sure the SdkToolsPath is set and the tool exists in the correct processor specific location under the SdkToolsPath and that the Microsoft Windows SDK is installed xxx

解決方法:
這個狀況其實就是預設Spread一開所放置的是免費試用的版本
開新的專案(Project)要先手動直接刪除,再重新編譯就會再次自動產生有付費後的版本