如何绘制图表并将其加载到word文档中? [英] How do I draw charts and load them into a word document?
问题描述
我正在尝试使用从数据库中获取的数据构建一个小软件来生成报告。
我的一个要求是绘制基于图表的图表选择的天数。我的初步测试工作时间很短,持续时间为1周。当我转到我的要求的上限时,我遇到了excel的问题,告诉我我最多只能有255个数据系列。
是否有其他原生API我可以用来生成图表并将它们加载到word文档中?我希望保持与正常生成的图形相同的外观和感觉。
我尝试了什么:
我尝试使用Microsoft.Office.Interop.Word.Chart绘制图表。
当Excel报告我只能拥有255个数据集时,软件崩溃了。
我也在考虑使用多个图表而没有填充重叠在第一个以实现类似的效果,但到目前为止,我还没有得到第一个内联图表的锚点。
I am trying to build a small software to generate reports using the data I obtained from a database.
One of my requirements was to draw charts based on the number of days selected. My initial testing was working fine for a short duration from 1 week's worth of data. When I shifted to upper limit of my requirements I faced the problem of excel telling me that I can only have up to 255 data series.
Are there any other native APIs that I can use to generate the graphs and load them into a word document? I am hoping to keep the same look and feel as the normally generated graphs.
What I have tried:
I have tried using Microsoft.Office.Interop.Word.Chart to draw the charts.
The software crashed when Excel reports that I can only have 255 data sets.
I am also considering using multiple charts with no fills to overlay over the first one to achieve the similar effect but thus far, I have not been able to get the anchor of the first inline chart.
推荐答案
嗯,有一个众所周知的限制。请参阅: Excel规范和限制 - Excel [ ^ ]
但是有一种解决方法: Excel Made Easy每个图表超过255个数据系列 [ ^ ]
如果有效,值得尝试。
Well, there's a well known limitation. See: Excel specifications and limits - Excel[^]
But there's is a workaround: More than 255 data series per chart with Excel Made Easy[^]
It's worth to try, if it works.
这篇关于如何绘制图表并将其加载到word文档中?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!