本文介绍了导出图表访问图像格式?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我已经在Access表单中创建了一个图表,并以图像格式将其导出。这很容易做到,但是问题出在之后,当我关闭窗体时,它会显示一条弹出消息。

I have created a chart in Access forms and exported it in Image Format. It's easily done, but the problem comes when after it, when I close the Form, It Shows a Pop-up message.

然后我做了一些更改,代码看起来像这样:

Then I have done some change and the Code looks Like:

Private Sub Command1_Click()
  Dim grpApp As Graph.Chart

  Set grpApp = Me.Graph1.Object
  grpApp.Export "C:\Graph1.jpg", "JPEG"
  Me.Graph1.Enabled = True
  Me.Graph1.Locked = False
  Set grpApp = Nothing
  Me.Graph1.Action = acOLEClose
End Sub

现在问题是导出完成后,图表变坏了,字体变大了
并压缩了,条形看上去很短...

Now the problem is that after the export is done, the chart becomes bad, the fonts were bigand condensed and the bars looked short...

I' m确实卡住了。

I'm really stuck..

推荐答案

尝试了各种变通办法之后,我发现了几乎相同的问题,并且为该问题找到了适当的解决方法:

After trying various workarounds, I found pretty much the same question and a proper fix for the problem:


  • 尝试在导出之前解锁图形,然后再恢复锁定

'Unlock the control...
Me!YourOLEChart.Locked = False
Me!YourOLEChart.Enabled = True

'Do the actual export...
Set oleGrf = Me!YourOLEChart.Object
oleGrf.Export filename, "JPEG"
Set oleGrf = Nothing
Me!YourOLEChart.Action = acOLEClose

'Restore the lock...
Me!YourOLEChart.Locked = True
Me!YourOLEChart.Enabled = False





  • 重要提示:切记设置Action acOLEClose以避免OLE服务器崩溃

  • 您并不孤单-我遇到了同样的问题。在几次运行该窗体后,执行导出操作后,图表/图形/ OLEFrame出现错误(在视图窗体上),其格式发生了变化,我不知道为什么。

    You are not alone—I had the same problem. On several runs of the form, after the export execution, the chart/graph/OLEFrame became wrong (on the form View), its format got changed and I hadn't known why.

    这篇关于导出图表访问图像格式?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

08-04 15:00
查看更多