@@ -890,42 +890,39 @@ public static XElement CoalesceAdjacentRunsWithIdenticalFormatting(XElement runC
890
890
IEnumerable < IEnumerable < XAttribute > > statusAtt =
891
891
g . Select ( r => r . Descendants ( W . t ) . Take ( 1 ) . Attributes ( PtOpenXml . Status ) ) ;
892
892
return new XElement ( W . r ,
893
+ g . First ( ) . Attributes ( ) ,
893
894
g . First ( ) . Elements ( W . rPr ) ,
894
895
new XElement ( W . t , statusAtt , xs , textValue ) ) ;
895
896
}
896
897
897
898
if ( g . First ( ) . Element ( W . instrText ) != null )
898
899
return new XElement ( W . r ,
900
+ g . First ( ) . Attributes ( ) ,
899
901
g . First ( ) . Elements ( W . rPr ) ,
900
902
new XElement ( W . instrText , xs , textValue ) ) ;
901
903
}
902
904
903
905
if ( g . First ( ) . Name == W . ins )
904
906
{
905
- #if false
906
- if ( g . First ( ) . Elements ( W . del ) . Any ( ) )
907
- return new XElement ( W . ins ,
908
- g . First ( ) . Attributes ( ) ,
909
- new XElement ( W . del ,
910
- g . First ( ) . Elements ( W . del ) . Attributes ( ) ,
911
- new XElement ( W . r ,
912
- g . First ( ) . Elements ( W . del ) . Elements ( W . r ) . Elements ( W . rPr ) ,
913
- new XElement ( W . delText , xs , textValue ) ) ) ) ;
914
- #endif
907
+ XElement firstR = g . First ( ) . Element ( W . r ) ;
915
908
return new XElement ( W . ins ,
916
909
g . First ( ) . Attributes ( ) ,
917
910
new XElement ( W . r ,
911
+ firstR ? . Attributes ( ) ,
918
912
g . First ( ) . Elements ( W . r ) . Elements ( W . rPr ) ,
919
913
new XElement ( W . t , xs , textValue ) ) ) ;
920
914
}
921
915
922
916
if ( g . First ( ) . Name == W . del )
917
+ {
918
+ XElement firstR = g . First ( ) . Element ( W . r ) ;
923
919
return new XElement ( W . del ,
924
920
g . First ( ) . Attributes ( ) ,
925
921
new XElement ( W . r ,
922
+ firstR ? . Attributes ( ) ,
926
923
g . First ( ) . Elements ( W . r ) . Elements ( W . rPr ) ,
927
924
new XElement ( W . delText , xs , textValue ) ) ) ;
928
-
925
+ }
929
926
return g ;
930
927
} ) ) ;
931
928
0 commit comments