Browse Source

cell in oneline style.awk

wangyh 4 years ago
parent
commit
8d9ce274eb
1 changed files with 23 additions and 0 deletions
  1. 23 0
      style.awk

+ 23 - 0
style.awk

@@ -2,6 +2,7 @@ BEGIN{
     styles=0
     in_style=0
     rows=-1
+    in_cell=0
 }
 {
 
@@ -28,6 +29,28 @@ BEGIN{
         # if(styles<3) styles++
     # }
 
+    if(match($0,"^ *<Cell>.*</Cell>$")){
+        print 
+        next
+    }
+    if(match($0,"^ *<Cell>")){
+        ORS=""
+        in_cell=1
+        print
+        next
+    }
+    if(in_cell==1){
+        gsub("^ +"," ",$0)
+    }
+    if(match($0,"</Cell>$")){
+        in_cell=0
+    }
+    if(in_cell==1){
+        ORS=""
+        gsub("\r?\n","",$0)
+    }else{
+        ORS="\n"
+    }
     if(match($0,"^ *<Style ")){
         in_style=1
         if(styles==0){