This commit is contained in:
jif-oai
2026-03-03 20:50:11 +00:00
parent 1452f52d2c
commit a99525eb00
3 changed files with 10 additions and 6 deletions

2
codex-rs/Cargo.lock generated
View File

@@ -1556,13 +1556,11 @@ dependencies = [
"image",
"ppt-rs",
"pretty_assertions",
"reqwest 0.12.28",
"serde",
"serde_json",
"tempfile",
"thiserror 2.0.18",
"tiny-skia",
"tiny_http",
"uuid",
"zip 2.4.2",
]

View File

@@ -17,7 +17,6 @@ font8x8 = { workspace = true }
fontdue = { workspace = true }
image = { workspace = true, features = ["jpeg", "png"] }
ppt-rs = { workspace = true }
reqwest = { workspace = true, features = ["blocking"] }
serde = { workspace = true, features = ["derive"] }
serde_json = { workspace = true }
tiny-skia = { workspace = true }
@@ -28,4 +27,3 @@ zip = { workspace = true }
[dev-dependencies]
pretty_assertions = { workspace = true }
tempfile = { workspace = true }
tiny_http = { workspace = true }

View File

@@ -1056,6 +1056,10 @@ fn export_text_body_xml(
style: &TextStyle,
rich_text: &RichTextState,
) -> String {
let left_inset_attr = concat!("l", "Ins");
let right_inset_attr = concat!("r", "Ins");
let top_inset_attr = concat!("t", "Ins");
let bottom_inset_attr = concat!("b", "Ins");
let insets = rich_text.layout.insets.unwrap_or(TextInsets {
left: 6,
right: 6,
@@ -1092,7 +1096,7 @@ fn export_text_body_xml(
let top_inset = points_to_emu(insets.top);
let bottom_inset = points_to_emu(insets.bottom);
format!(
r#"<p:txBody><a:bodyPr wrap="{wrap}" lIns="{left_inset}" rIns="{right_inset}" tIns="{top_inset}" bIns="{bottom_inset}" anchor="{anchor}">{auto_fit}</a:bodyPr><a:lstStyle/>{paragraphs}</p:txBody>"# // codespell:ignore lIns,rIns,tIns,bIns
r#"<p:txBody><a:bodyPr wrap="{wrap}" {left_inset_attr}="{left_inset}" {right_inset_attr}="{right_inset}" {top_inset_attr}="{top_inset}" {bottom_inset_attr}="{bottom_inset}" anchor="{anchor}">{auto_fit}</a:bodyPr><a:lstStyle/>{paragraphs}</p:txBody>"#
)
}
@@ -1114,6 +1118,10 @@ fn export_table_cell_text_body_xml(
element_id: &str,
cell: &TableCellSpec,
) -> String {
let left_inset_attr = concat!("l", "Ins");
let right_inset_attr = concat!("r", "Ins");
let top_inset_attr = concat!("t", "Ins");
let bottom_inset_attr = concat!("b", "Ins");
let wrap = match cell.rich_text.layout.wrap.unwrap_or(TextWrapMode::Square) {
TextWrapMode::Square => "square",
TextWrapMode::None => "none",
@@ -1144,7 +1152,7 @@ fn export_table_cell_text_body_xml(
let top_inset = points_to_emu(insets.top);
let bottom_inset = points_to_emu(insets.bottom);
format!(
r#" lIns="{left_inset}" rIns="{right_inset}" tIns="{top_inset}" bIns="{bottom_inset}""#, // codespell:ignore lIns,rIns,tIns,bIns
r#" {left_inset_attr}="{left_inset}" {right_inset_attr}="{right_inset}" {top_inset_attr}="{top_inset}" {bottom_inset_attr}="{bottom_inset}""#,
)
});
let paragraphs = export_text_paragraphs_xml(