如何将图表导出为具有最高分辨率的图片
Posted
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了如何将图表导出为具有最高分辨率的图片相关的知识,希望对你有一定的参考价值。
我编写了以下代码来选择范围并创建图表。图表稍后导出为图片。它的工作原理,然而由于选择的范围来自A2:U111,因此图像的清晰度非常差。我正在使用的代码是。
Dim sSheetName2 As String
Dim sSheetName3 As String
Dim oRangeToCopy As Range
Dim oCht As Chart
Dim comm As String
Workbooks("Workbook").Activate
Worksheets("Worksheet").Activate
sSheetName2 = "Worksheet" ' worksheet to work on
Worksheets(sSheetName2).Range("A2:U111").CopyPicture xlScreen, xlBitmap
Set oCht = Charts.Add
Charts("Chart1").Activate
ActiveWindow.Zoom = 400
With oCht
.Paste
.Export Filename:="D:
r.jpg", Filtername:="JPG"
End With
我也试图减小范围大小,但它变得像素化。
答案
Dim sSheetName2 As String
Dim sSheetName3 As String
Dim oRangeToCopy As Range
Dim oCht As Chart
Dim comm As String
Workbooks("workbook").Activate
Worksheets("worksheet").Activate
Range("A2:U111").Select
With Selection.Font
.Size = 9
.Strikethrough = False
.Superscript = False
.Subscript = False
.OutlineFont = False
.Shadow = False
.Underline = xlUnderlineStyleNone
.TintAndShade = 0
End With
sSheetName2 = "worksheet" ' worksheet to work on
Worksheets(sSheetName2).Range("A2:U20").CopyPicture xlScreen, xlBitmap
Set oCht = Charts.Add
oCht.Activate
ActiveWindow.Zoom = 400
With oCht
.Paste
.Export Filename:="D:
r.jpg", Filtername:="JPG"
End With
我多次运行代码,代码放大了代码中提到的chart1。
oCht.Activate
ActiveWindow.Zoom = 400
With oCht
.Paste
.Export Filename:="D:
r.jpg", Filtername:="JPG"
End With
现在它选择最近创建的图表。我也增加了字体大小。
以上是关于如何将图表导出为具有最高分辨率的图片的主要内容,如果未能解决你的问题,请参考以下文章