files.zip (91.0 KB)
In the attached zip file, you will find input.doc, expected.doc, and actual.doc.
The code that processes input.doc into actual.doc is large and proprietary. I’m trying to extract a small version of it, but it’s taking a lot of time and effort.
In the meantime, maybe these documents will show you a bit about what I’m talking about. The code takes in input.doc, replaces all the long cells with merged cells, deletes the third column, then replaces the merged cells with long cells again. This all seems to work fine.
When I call Document.save(…), the cell formats are changed and the resulting document reflects the changed values (which are wrong).
I’ve been printing the values from cell format to the screen just before and just after the call to Document.save(…). Note that the Width of Cell[1,1], Cell[1,2], and Cell[1,3] all change:
Before Document.save(…)
===== Table[0] =====
---- Row[0] ----
Cell[0,0] - Width: 36.0 PrefWidth: 36.0 Width/PrefWidth: 1.0 Merge: 0 ... A1a
Cell[0,1] - Width: 36.0 PrefWidth: 36.0 Width/PrefWidth: 1.0 Merge: 0 ... B1a
Cell[0,2] - Width: 31.7 PrefWidth: 31.7 Width/PrefWidth: 1.0 Merge: 0 ... D1a
Cell[0,3] - Width: 39.6 PrefWidth: 39.6 Width/PrefWidth: 1.0 Merge: 0 ... E1a
Cell[0,4] - Width: 47.5 PrefWidth: 47.5 Width/PrefWidth: 1.0 Merge: 0 ... F1a
---- Row[1] ----
Cell[1,0] - Width: 36.0 PrefWidth: 36.0 Width/PrefWidth: 1.0 Merge: 0 ... A3a
Cell[1,1] - Width: 36.0 PrefWidth: 36.0 Width/PrefWidth: 1.0 Merge: 0 ... B3/C3a
Cell[1,2] - Width: 31.7 PrefWidth: 31.7 Width/PrefWidth: 1.0 Merge: 0 ... D3a
Cell[1,3] - Width: 39.6 PrefWidth: 39.6 Width/PrefWidth: 1.0 Merge: 0 ... E3a
Cell[1,4] - Width: 47.5 PrefWidth: 47.5 Width/PrefWidth: 1.0 Merge: 0 ... F3a
After Document.save(…)
===== Table[0] =====
---- Row[0] ----
Cell[0,0] - Width: 36.0 PrefWidth: 36.0 Width/PrefWidth: 1.0 Merge: 0 ... A1a
Cell[0,1] - Width: 36.0 PrefWidth: 36.0 Width/PrefWidth: 1.0 Merge: 0 ... B1a
Cell[0,2] - Width: 31.7 PrefWidth: 31.7 Width/PrefWidth: 1.0 Merge: 0 ... D1a
Cell[0,3] - Width: 39.6 PrefWidth: 39.6 Width/PrefWidth: 1.0 Merge: 0 ... E1a
Cell[0,4] - Width: 47.5 PrefWidth: 47.5 Width/PrefWidth: 1.0 Merge: 0 ... F1a
---- Row[1] ----
Cell[1,0] - Width: 36.0 PrefWidth: 36.0 Width/PrefWidth: 1.0 Merge: 0 ... A3a
Cell[1,1] - Width: 67.7 PrefWidth: 36.0 Width/PrefWidth: 1.8805555555555555 Merge: 0 ... B3/C3a
Cell[1,2] - Width: 39.6 PrefWidth: 31.7 Width/PrefWidth: 1.249211356466877 Merge: 0 ... D3a
Cell[1,3] - Width: 47.5 PrefWidth: 39.6 Width/PrefWidth: 1.1994949494949494 Merge: 0 ... E3a
Cell[1,4] - Width: 47.5 PrefWidth: 47.5 Width/PrefWidth: 1.0 Merge: 0 ... F3a