我试图通过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#:
[]
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.
更多推荐
发布评论