@@ -651,10 +651,34 @@ public void LoadRGF(Stream s)
651651							throw  new  ReoGridLoadException ( "Cannot create cell body instance from type: "  +  xmlCell . bodyType ,  ex ) ; 
652652						} 
653653					} 
654+ 
655+ 					if  ( type  ==  typeof ( CellTypes . ImageCell ) ) 
656+ 					{ 
657+ 						int  leftIndex  =  xmlCell . data . IndexOf ( ',' ) ; 
658+ 						if  ( leftIndex  >  0 ) 
659+ 						{ 
660+ 							string  mimetype  =  xmlCell . data . Substring ( 0 ,  leftIndex ) ; 
661+ 							if  ( mimetype  ==  "image/png" ) 
662+ 							{ 
663+ 								string  imgcode  =  xmlCell . data . Substring ( leftIndex  +  1 ) ; 
664+ 
665+ 								using  ( var  ms  =  new  MemoryStream ( Convert . FromBase64String ( imgcode ) ) ) 
666+ 								{ 
667+ 									var  img  =  System . Drawing . Image . FromStream ( ms ) ; 
668+ 									( ( CellTypes . ImageCell ) cell . body ) . Image  =  img ; 
669+ 								} 
670+ 
671+ 								cellValue  =  null ; 
672+ 							} 
673+ 						} 
674+ 					} 
654675				} 
655676				#endregion // Body 
656677
657- 				SetSingleCellData ( cell ,  cellValue ) ; 
678+ 				if  ( ! string . IsNullOrEmpty ( cellValue ) ) 
679+ 				{ 
680+ 					SetSingleCellData ( cell ,  cellValue ) ; 
681+ 				} 
658682
659683#if FORMULA 
660684				if  ( ! string . IsNullOrEmpty ( formula ) ) 
@@ -1231,7 +1255,7 @@ from nr in this.registeredNamedRanges.Values
12311255								 { 
12321256									 bool  addCell  =  false ; 
12331257
1234- 									 if  ( cell . InnerData  !=  null  ||  cell . Rowspan  >  1  ||  cell . Colspan  >  1 )  addCell  =  true ; 
1258+ 									 if  ( cell . InnerData  !=  null  ||  cell . Rowspan  >  1  ||  cell . Colspan  >  1   ||   cell . body   !=   null )  addCell  =  true ; 
12351259
12361260									 RGXmlCellStyle  xmlStyle  =  null ; 
12371261
@@ -1316,6 +1340,16 @@ from nr in this.registeredNamedRanges.Values
13161340											 xmlCell . formula  =  new  RGXmlCellFormual  {  val  =  ( bool ) cell . InnerData  ?  "True"  :  "False"  } ; 
13171341										 } 
13181342
1343+ 										 if  ( cell . body  is  CellTypes . ImageCell ) 
1344+ 										 { 
1345+ 											 var  imageBody  =  ( CellTypes . ImageCell ) cell . body ; 
1346+ 											 using  ( var  ms  =  new  MemoryStream ( ) ) 
1347+ 											 { 
1348+ 												 imageBody . Image . Save ( ms ,  System . Drawing . Imaging . ImageFormat . Png ) ; 
1349+ 												 xmlCell . data  =  "image/png,"  +  Convert . ToBase64String ( ms . ToArray ( ) ) ; 
1350+ 											 } 
1351+ 										 } 
1352+ 
13191353										 body . cells . Add ( xmlCell ) ; 
13201354									 } 
13211355									 #endregion // Cell 
0 commit comments