我将制作一个项目,将数据和图表转换为powerpoint文件以转换为excel文件。图表验证
,但我发现这里的一些问题,,
我必须做一个项目,以图表转换,这个脚本
公共静态无效GetChart(字符串strFilePath,串strDestPath) {
xl.Application xlApp; xl.Workbook xlWorkBook; xl.Worksheet xlWorkSheet; object misValue = System.Reflection.Missing.Value; xlApp = new xl.ApplicationClass(); xlWorkBook = xlApp.Workbooks.Open(strFilePath, 0, true, 5,
“”,“”,true, Microsoft.Office.Interop.Excel.XlPlatform.xlWindows, “\ t”,false,false,0,true,1,0) ; xlWorkSheet = (xl.Worksheet)xlWorkBook.Worksheets.get_Item(1); xl.ChartObjects xlCharts = (xl.ChartObjects)xlWorkSheet.ChartObjects(Type.Missing); xl.ChartObject myChart =(xl.ChartObject)xlCharts.Item(1); xl.Chart chartPage = myChart.Chart;
,然后我把它转换成图像通过该脚本
GetChart(@ “” + textBox1.Text + “”,@ “d:\” + textBox2.Text +” .JPEG “); label5.Text = @“D:\”+ textBox2.Text +“.jpeg”;
pictureBox1.Image = new Bitmap(@"" + label5.Text +
“”);
但我认为并非所有的excel文件都包含图表,所以我尝试搜索关于如何在每个excel文件中检测图表的验证。
我该怎么办?