feat(docx): add hi-fidelity XML injections for tables, styles, lists, and sections; extend tools and tests

- Add feature flags: hi-fidelity-tables, hi-fidelity-styles, hi-fidelity-lists, hi-fidelity-sections
- Tables: inject true w:gridSpan/w:vMerge and w:tblGrid widths via post-build XML when enabled
- Styles: ensure TableHeader style in styles.xml; tag first row when headers present
- Lists: robust numbering.xml for ordered/unordered with multi-level definitions
- Sections: write tail w:sectPr with page size/orientation/margins
- Tools: expose new operations (sections, list items, images, hyperlinks, props, redaction, storage)
- Converters: add preference-aware methods for hi-fidelity export paths; HTML export tool
- Tests: add golden XML assertions gated by feature flags; keep default build green

This enables high-fidelity DOCX output while keeping pure-Rust paths by default.
This commit is contained in:
Andy
2025-08-12 23:25:29 +08:00
parent c30f55d16d
commit 90305551cc
14 changed files with 1983 additions and 277 deletions
+21
View File
@@ -114,6 +114,9 @@ pub fn create_technical_report(handler: &mut DocxHandler) -> Result<String> {
],
headers: Some(vec!["Service".to_string(), "Q3 2024 (ms)".to_string(), "Q4 2024 (ms)".to_string(), "Improvement".to_string()]),
border_style: Some("single".to_string()),
col_widths: None,
merges: None,
cell_shading: None,
};
handler.add_table(&doc_id, response_time_data)?;
@@ -131,6 +134,9 @@ pub fn create_technical_report(handler: &mut DocxHandler) -> Result<String> {
],
headers: Some(vec!["Metric".to_string(), "Target".to_string(), "Actual".to_string(), "Status".to_string()]),
border_style: Some("single".to_string()),
col_widths: None,
merges: None,
cell_shading: None,
};
handler.add_table(&doc_id, reliability_data)?;
@@ -189,6 +195,9 @@ pub fn create_meeting_minutes(handler: &mut DocxHandler) -> Result<String> {
],
headers: None,
border_style: Some("single".to_string()),
col_widths: None,
merges: None,
cell_shading: None,
};
handler.add_table(&doc_id, meeting_details)?;
@@ -235,6 +244,9 @@ pub fn create_meeting_minutes(handler: &mut DocxHandler) -> Result<String> {
],
headers: Some(vec!["Category".to_string(), "Budgeted".to_string(), "Actual".to_string(), "Remaining".to_string()]),
border_style: Some("single".to_string()),
col_widths: None,
merges: None,
cell_shading: None,
};
handler.add_table(&doc_id, budget_data)?;
@@ -263,6 +275,9 @@ pub fn create_meeting_minutes(handler: &mut DocxHandler) -> Result<String> {
],
headers: Some(vec!["Action Item".to_string(), "Owner".to_string(), "Due Date".to_string(), "Status".to_string()]),
border_style: Some("single".to_string()),
col_widths: None,
merges: None,
cell_shading: None,
};
handler.add_table(&doc_id, action_items_data)?;
@@ -371,6 +386,9 @@ pub fn create_product_spec(handler: &mut DocxHandler) -> Result<String> {
],
headers: Some(vec!["Requirement".to_string(), "Specification".to_string(), "Priority".to_string()]),
border_style: Some("single".to_string()),
col_widths: None,
merges: None,
cell_shading: None,
};
handler.add_table(&doc_id, nfr_data)?;
@@ -502,6 +520,9 @@ pub fn create_formatted_document(handler: &mut DocxHandler) -> Result<String> {
],
headers: Some(vec!["Item".to_string(), "Price".to_string(), "Discount".to_string(), "Final Price".to_string()]),
border_style: Some("single".to_string()),
col_widths: None,
merges: None,
cell_shading: None,
};
handler.add_table(&doc_id, formatted_table)?;