如何使用interop C#从excel获得迷你图 [英] How to get sparklines from excel using interop C#
本文介绍了如何使用interop C#从excel获得迷你图的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
亲爱的所有人,
我创建了自动化MsOffice的Windows应用程序。
我必须评估插入的迷你图(想要获取:类型,主题,颜色等)在Excel工作表中(已经存在)。
我尝试过:
Dear All,
I have created Windows application where automating MsOffice.
I have to evaluate inserted sparkline(would like fetch: type, theme, color, etc) in the excel worksheet(already exists).
What I have tried:
public static bool EvaluateSparkline(IQuestion question, string filename, string sheetName, string sparklineRange)
{
ExcelInterop.Application excelApplication = null;
try
{
excelApplication = new ExcelInterop.Application() { Visible = false, DisplayAlerts = false, ScreenUpdating = false };
ExcelInterop.Workbook excelWorkbook = excelApplication.Workbooks.Open(filename);
ExcelInterop.Worksheet excelWorksheet = excelWorkbook.Sheets[sheetName];
bool result = false;
if (excelWorkbook != null && excelWorksheet != null)
{
ExcelInterop.Range sparklineLocation = excelWorksheet.get_Range("F2"); ;
ExcelInterop.SparklineGroup sparkline = sparklineLocation.SparklineGroups.Item[1].Location;
}
excelWorkbook.Close();
return result;
}
catch (Exception)
{
return false;
}
finally
{
QuitApplication(excelApplication);
}
}
任何人都可以帮助我,如何找出迷你图和它的属性。 />
提前致谢。
Can anyone please help me, how to find out sparkline and its properties.
Thanks in advance.
推荐答案
SparklineGroups excel interop - Google搜索 [ ^ ]
这篇关于如何使用interop C#从excel获得迷你图的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文