作成日: 2024/02/01 最終更新日: 2025/02/26
文書種別
不具合
状況
修正済み
詳細
Excelファイルのインポートを行い、PrintInfoクラスの各種プロパティが設定されたシートで、SheetView.Cloneメソッドを実行すると、CloneによってコピーされたシートにPrintInfoがコピーされず、規定値が設定されます。
本来であれば、コピー元のシートのPrintInfoの設定値がコピー後のシートのPrintInfoに設定されます。
回避方法
Service Pack 4(v15.0.4804.2012/v15.4.0)で修正済み。
Service Pack 4を適用せずに対処する方法としては、以下のCopyFromメソッドのように、シートのCloneを実行した後にPrintInfoをコピーすることで本現象を回避できます。
Dim sheet2 = sheet1.Clone
CopyFrom(sheet2.PrintInfo, sheet1.PrintInfo)
Public Sub CopyFrom(ByVal source As PrintInfo, ByVal info As PrintInfo)
source.PdfSecurity = info.PdfSecurity
source.Header = info.Header
source.Footer = info.Footer
source.JobName = info.JobName
source.Margin = info.Margin
source.Orientation = info.Orientation
source.PageOrder = info.PageOrder
source.ShowBorder = info.ShowBorder
source.ShowColumnHeaders = info.ShowColumnHeaders
source.ShowColumnFooter = info.ShowColumnFooter
source.ShowColumnFooterEachPage = info.ShowColumnFooterEachPage
source.ShowColor = info.ShowColor
source.ShowGrid = info.ShowGrid
source.ShowRowHeaders = info.ShowRowHeaders
source.ShowShadows = info.ShowShadows
source.UseMax = info.UseMax
source.ColStart = info.ColStart
source.ColEnd = info.ColEnd
source.RowStart = info.RowStart
source.RowEnd = info.RowEnd
source.PageStart = info.PageStart
source.PageEnd = info.PageEnd
source.UseSmartPrint = info.UseSmartPrint
source.FirstPageNumber = info.FirstPageNumber
source.ZoomFactor = info.ZoomFactor
source.Printer = info.Printer
source.Preview = info.Preview
source.ShowPrintDialog = info.ShowPrintDialog
source.PrintType = info.PrintType
source.BestFitCols = info.BestFitCols
source.BestFitRows = info.BestFitRows
source.Duplex = info.Duplex
source.EnhancePreview = info.EnhancePreview
source.ShowPageSetupButton = info.ShowPageSetupButton
source.BestFitWithSpan = info.BestFitWithSpan
source.AbortMessage = info.AbortMessage
source.SmartPrintRules = info.SmartPrintRules
source.Opacity = info.Opacity
source.PrintNotes = info.PrintNotes
source.PaperSource = info.PaperSource
source.PaperSize = info.PaperSize
source.Images = info.Images
source.Colors = info.Colors
source.RepeatColStart = info.RepeatColStart
source.RepeatColEnd = info.RepeatColEnd
source.RepeatRowStart = info.RepeatRowStart
source.RepeatRowEnd = info.RepeatRowEnd
source.Centering = info.Centering
source.SmartPrintPagesTall = info.SmartPrintPagesTall
source.SmartPrintPagesWide = info.SmartPrintPagesWide
End Sub