是否可以通过OpenXML / ClosedXML SDK在Excel中绘制迷你图(趋势图)(Is it possible to draw sparklines (Trend graphs) in E

编程入门 行业动态 更新时间:2024-10-09 19:24:09
是否可以通过OpenXML / ClosedXML SDK在Excel中绘制迷你图(趋势图)(Is it possible to draw sparklines (Trend graphs) in Excel Through OpenXML/ClosedXML SDK)

我试图通过C#应用程序在Excel中绘制迷你图,但我找不到任何代码文档/示例来在Excel中绘制迷你图,我检查了OpenXML / ClosedXML SDK。

请提供此功能的文档或代码段的任何参考

I'm trying to draw a sparklines in Excel through C# application, but I couldn't find any code documentation/samples to draw sparklines in Excel, I checked the OpenXML/ClosedXML SDks.

Please provide any references of documentation or code snippets for this functionality

最满意答案

是的 - 可以使用Open XML。 Excel文件的几乎所有部分都可以使用Open XML Productivity Tool反向设计为C#代码。 我刚刚做了一个简单的Sparkline示例并使用C#生成了以下Excel文件:

[ 在此处输入图像描述 ]

跟着这些步骤:

使用Productivity Tool安装Open XML SDK 使用迷你图生成Excel文件,以满足您的特定项目需求。 在Open XML Productivity Tool中打开文件。 选择文件中的基本元素,然后单击Reflect Code按钮,它将在右侧窗格中为您生成C#代码。

由于您是C#开发人员,因此您需要对代码进行适当的更改以满足您的产品/解决方案的需求。

我已经将生成上述迷你图的代码发布到GitHub 。 随意下载并运行它。 它是一个简单的单按钮WPF,并将其保存到您指定的文件名。

Yes - it is possible with Open XML. Almost all parts of an Excel file, can be reverse engineered into C# code using the Open XML Productivity Tool. I just did a simple Sparkline example and have generated the the below Excel file using C#:

[enter image description here]

Follow these steps:

Install Open XML SDK with the Productivity Tool Generate an Excel file with Sparklines for your particular project needs. Open the file inside the Open XML Productivity Tool. Select the base element in the file and Click the Reflect Code button and it will generate the C# code for you in the right hand pane.

Since you are the C# developer, you will then need to make the appropriate changes the code to fit the needs of your product/solution.

I have posted the code that generated the above sparkline to GitHub. Feel free to download it and run it. It is a simple one button WPF and will save it to the file name you specify.

更多推荐

本文发布于:2023-07-06 07:45:00,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1047473.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:可以通过   趋势   SDK   ClosedXML   Excel

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!