1- using Syncfusion . DocIO ;
1+ using Syncfusion . DocIO ;
22using Syncfusion . DocIO . DLS ;
33using Syncfusion . DocIORenderer ;
44using System . Collections . Generic ;
@@ -17,9 +17,9 @@ static void Main(string[] args)
1717 using ( WordDocument wordDocument = new WordDocument ( fileStream , FormatType . Docx ) )
1818 {
1919 List < Entity > charts = wordDocument . FindAllItemsByProperty ( EntityType . Chart , null , null ) ;
20- foreach ( WChart entity in charts )
20+ for ( int i = 0 ; i < charts . Count ; i ++ )
2121 {
22- WChart chart = ( WChart ) entity ;
22+ WChart chart = ( WChart ) charts [ i ] ;
2323 //Get owner paragraph of chart.
2424 WParagraph paragraph = chart . OwnerParagraph ;
2525 //Get index of the chart in the paragraph.
@@ -40,8 +40,6 @@ static void Main(string[] args)
4040 //Add image to the paragraph at chart index.
4141 if ( chartIndex < paragraph . ChildEntities . Count )
4242 paragraph . ChildEntities . Insert ( chartIndex , picture ) ;
43- else
44- paragraph . ChildEntities . Add ( picture ) ;
4543 //Remove chart from the paragraph.
4644 paragraph . ChildEntities . Remove ( chart ) ;
4745 }
@@ -59,4 +57,3 @@ static void Main(string[] args)
5957 }
6058 }
6159}
62-
0 commit comments