Farhan Shariff

Farhan Shariff

  • NA
  • 933
  • 241.6k

Insert images from folder to word C#

Apr 16 2014 4:15 AM
My code generates Multiple Images into a folder I want to make a document file(Report) and insert all the images in to the word file


           for (int g = 0; g < table8.Columns.Count - 2; g++)
           {

            Chart chart1 = new Chart();
           chart1.Width = 1600;
           chart1.Height = 900;
           Series Series1 = new Series();
           Series series1 = new Series();
       
               
          Series Series2 = new Series();
       
           Series1.Name = "Series1";
           series1.Name = "series1";
           Series2.Name = "Series2";
 
               
           Series1.ChartType = SeriesChartType.Line;
         
           series1.ChartType = SeriesChartType.Point;  
           
                   
           Series2.ChartType = SeriesChartType.Line;
           Series2.BorderDashStyle = ChartDashStyle.Solid;
   
 
            //create chartareas...
            ChartArea ca = new ChartArea();
            ca.Name = "ChartArea1";
           
            ca.AxisX = new Axis();
            ca.AxisY = new Axis();

            chart1.ChartAreas.Add(ca);

            chart1.Series.Add(Series1);
           chart1.Series.Add(Series2);
            chart1.Series.Add(series1);

  chart1.Series["Series1"].Points.DataBindXY(ds.Tables[0].DefaultView,table8.Columns[g].ColumnName, ds.Tables[0].DefaultView, "Normal_Inverse");
  chart1.Series["series1"].Points.DataBindXY(ds.Tables[0].DefaultView, table8.Columns[g].ColumnName, ds.Tables[0].DefaultView, "Normal_Inverse");
           chart1.Series["Series2"].Points.DataBindXY(ds.Tables[1].DefaultView, table10.Columns[g].ColumnName, ds.Tables[1].DefaultView, "Normal_Inverse"); // binding to second table

            chart1.ChartAreas[0].AxisY.Minimum = -3;
           chart1.ChartAreas[0].AxisY.Maximum = 3.60;

          Title title = chart1.Titles.Add(table8.Columns[g].ColumnName);
                       


    chart1.SaveImage(@"C:\Matlab\" + (g).ToString() + ".png", ChartImageFormat.Png);
       
       
        } //I want to combine all images generated in to one Word document File



Answers (6)