paraencoder 0.2.0__tar.gz → 0.2.1__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: paraencoder
3
- Version: 0.2.0
3
+ Version: 0.2.1
4
4
  Summary: Burmese text detection and conversion toolkit for Zawgyi and Unicode
5
5
  Project-URL: Homepage, https://github.com/Laitei40/ParaEncoder
6
6
  Project-URL: Repository, https://github.com/Laitei40/ParaEncoder
@@ -189,14 +189,49 @@ class XlsxHandler(FileHandler):
189
189
  output_path: Path,
190
190
  converter: Callable[[str], str],
191
191
  ) -> None:
192
+ # Load workbook preserving everything (images, charts, etc.)
192
193
  wb = openpyxl.load_workbook(str(input_path))
193
194
 
194
195
  for sheet in wb.worksheets:
196
+ # Convert regular cell values
195
197
  for row in sheet.iter_rows():
196
198
  for cell in row:
197
199
  if cell.value and isinstance(cell.value, str):
198
200
  cell.value = converter(cell.value)
199
201
 
202
+ # Convert merged cell values (they're stored in the top-left cell)
203
+ for merged_range in sheet.merged_cells.ranges:
204
+ cell = sheet.cell(merged_range.min_row, merged_range.min_col)
205
+ if cell.value and isinstance(cell.value, str):
206
+ cell.value = converter(cell.value)
207
+
208
+ # Convert comments
209
+ for row in sheet.iter_rows():
210
+ for cell in row:
211
+ if cell.comment and cell.comment.text:
212
+ cell.comment.text = converter(cell.comment.text)
213
+
214
+ # Convert header/footer
215
+ if sheet.oddHeader and sheet.oddHeader.center:
216
+ if sheet.oddHeader.center.text:
217
+ sheet.oddHeader.center.text = converter(sheet.oddHeader.center.text)
218
+ if sheet.oddHeader and sheet.oddHeader.left:
219
+ if sheet.oddHeader.left.text:
220
+ sheet.oddHeader.left.text = converter(sheet.oddHeader.left.text)
221
+ if sheet.oddHeader and sheet.oddHeader.right:
222
+ if sheet.oddHeader.right.text:
223
+ sheet.oddHeader.right.text = converter(sheet.oddHeader.right.text)
224
+ if sheet.oddFooter and sheet.oddFooter.center:
225
+ if sheet.oddFooter.center.text:
226
+ sheet.oddFooter.center.text = converter(sheet.oddFooter.center.text)
227
+
228
+ # Convert sheet names
229
+ for sheet in wb.worksheets:
230
+ original_title = sheet.title
231
+ converted_title = converter(original_title)
232
+ if converted_title != original_title:
233
+ sheet.title = converted_title
234
+
200
235
  wb.save(str(output_path))
201
236
 
202
237
  @staticmethod
@@ -4,7 +4,7 @@ build-backend = "hatchling.build"
4
4
 
5
5
  [project]
6
6
  name = "paraencoder"
7
- version = "0.2.0"
7
+ version = "0.2.1"
8
8
  description = "Burmese text detection and conversion toolkit for Zawgyi and Unicode"
9
9
  readme = "README.md"
10
10
  requires-python = ">=3.9"
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes