@@ -439,10 +439,11 @@ private static void ReplaceText(OpenXmlElement xmlElement, WordprocessingDocumen
439439 AddHyperLink ( docx , run , tag . Value ) ;
440440 t . Remove ( ) ;
441441 }
442- else if ( tag . Value is MiniWordColorText )
442+ else if ( tag . Value is MiniWordColorText || tag . Value is MiniWordColorText [ ] )
443443 {
444- var miniWordColorText = ( MiniWordColorText ) tag . Value ;
445- var colorText = AddColorText ( miniWordColorText ) ;
444+ var colorText = tag . Value is MiniWordColorText
445+ ? AddColorText ( new [ ] { ( MiniWordColorText ) tag . Value } )
446+ : AddColorText ( ( MiniWordColorText [ ] ) tag . Value ) ;
446447 run . Append ( colorText ) ;
447448 t . Remove ( ) ;
448449 }
@@ -533,16 +534,19 @@ private static Hyperlink GetHyperLink(MainDocumentPart mainPart, MiniWordHyperLi
533534 } ;
534535 return xmlHyperLink ;
535536 }
536- private static RunProperties AddColorText ( MiniWordColorText miniWordColorText )
537+ private static RunProperties AddColorText ( MiniWordColorText [ ] miniWordColorTextArray )
537538 {
538539
539540 RunProperties runPro = new RunProperties ( ) ;
540- Text text = new Text ( miniWordColorText . Text ) ;
541- Color color = new Color ( ) { Val = miniWordColorText . FontColor ? . Replace ( "#" , "" ) } ;
542- Shading shading = new Shading ( ) { Fill = miniWordColorText . HighlightColor ? . Replace ( "#" , "" ) } ;
543- runPro . Append ( shading ) ;
544- runPro . Append ( color ) ;
545- runPro . Append ( text ) ;
541+ foreach ( var miniWordColorText in miniWordColorTextArray )
542+ {
543+ Text text = new Text ( miniWordColorText . Text ) ;
544+ Color color = new Color ( ) { Val = miniWordColorText . FontColor ? . Replace ( "#" , "" ) } ;
545+ Shading shading = new Shading ( ) { Fill = miniWordColorText . HighlightColor ? . Replace ( "#" , "" ) } ;
546+ runPro . Append ( shading ) ;
547+ runPro . Append ( color ) ;
548+ runPro . Append ( text ) ;
549+ }
546550
547551 return runPro ;
548552 }
0 commit comments