1
- using Syncfusion . DocIO ;
1
+ using Syncfusion . DocIO ;
2
2
using Syncfusion . DocIO . DLS ;
3
3
using Syncfusion . DocIORenderer ;
4
4
using System . Collections . Generic ;
@@ -17,9 +17,9 @@ static void Main(string[] args)
17
17
using ( WordDocument wordDocument = new WordDocument ( fileStream , FormatType . Docx ) )
18
18
{
19
19
List < Entity > charts = wordDocument . FindAllItemsByProperty ( EntityType . Chart , null , null ) ;
20
- foreach ( WChart entity in charts )
20
+ for ( int i = 0 ; i < charts . Count ; i ++ )
21
21
{
22
- WChart chart = ( WChart ) entity ;
22
+ WChart chart = ( WChart ) charts [ i ] ;
23
23
//Get owner paragraph of chart.
24
24
WParagraph paragraph = chart . OwnerParagraph ;
25
25
//Get index of the chart in the paragraph.
@@ -40,8 +40,6 @@ static void Main(string[] args)
40
40
//Add image to the paragraph at chart index.
41
41
if ( chartIndex < paragraph . ChildEntities . Count )
42
42
paragraph . ChildEntities . Insert ( chartIndex , picture ) ;
43
- else
44
- paragraph . ChildEntities . Add ( picture ) ;
45
43
//Remove chart from the paragraph.
46
44
paragraph . ChildEntities . Remove ( chart ) ;
47
45
}
@@ -59,4 +57,3 @@ static void Main(string[] args)
59
57
}
60
58
}
61
59
}
62
-
0 commit comments