diff --git a/apps/server/src/provider/documentTextWorker.ts b/apps/server/src/provider/documentTextWorker.ts
index 5957fdd3cd892..52521495f9d5d 100644
--- a/apps/server/src/provider/documentTextWorker.ts
+++ b/apps/server/src/provider/documentTextWorker.ts
@@ -15,7 +15,8 @@ type TextPart = string | typeof CELL_START | typeof CELL_END | { fallback: strin
const TRUNCATED = "\n\n[Extracted text truncated at document extraction limits.]";
// Parts the document never displays: the XHTML head, tracked deletions and moves, field codes,
-// phonetic guides, paragraph properties such as tab-stop definitions.
+// phonetic guides, paragraph properties such as tab-stop definitions, drawing anchor layout
+// values and encoded field data.
const HIDDEN = new Set([
"head",
"script",
@@ -28,6 +29,11 @@ const HIDDEN = new Set([
"delInstrText",
"tracked-changes",
"pPr",
+ "positionH",
+ "positionV",
+ "sizeRelH",
+ "sizeRelV",
+ "fldData",
]);
// @effect-diagnostics-next-line extendsNativeError:off - this worker loads no Effect runtime; Truncation is a local throw sentinel.
@@ -109,7 +115,7 @@ function xml(source: string, extension: string): XmlNode {
parent.children.pop();
return;
}
- if (!node.hasText && node.name !== "noBreakHyphen") return;
+ if (HIDDEN.has(node.name) || (!node.hasText && node.name !== "noBreakHyphen")) return;
parent.hasText = true;
if (node.name === "Choice") parent.hasTextChoice = true;
});
diff --git a/apps/server/src/provider/userInputAttachments.test.ts b/apps/server/src/provider/userInputAttachments.test.ts
index 4087601b58c0b..570fcc2fe4d5f 100644
--- a/apps/server/src/provider/userInputAttachments.test.ts
+++ b/apps/server/src/provider/userInputAttachments.test.ts
@@ -483,6 +483,37 @@ describe("question answer paths", () => {
Effect.gen(function* () {
const config = yield* ServerConfig.ServerConfig;
const cases = [
+ // Word stores object layout and field data outside the visible document text.
+ {
+ ext: "docx",
+ bounded: true,
+ parts: {
+ "word/document.xml":
+ 'Total cost is 1905000-6350042 EUR.',
+ },
+ expected: ["Total cost is 42 EUR."],
+ absent: ["1905000", "-635", "0042"],
+ },
+ {
+ ext: "docx",
+ bounded: true,
+ parts: {
+ "word/document.xml":
+ '1905000-63500Chart caption',
+ },
+ expected: ["Chart caption"],
+ absent: ["1905000", "-635"],
+ },
+ {
+ ext: "docx",
+ bounded: true,
+ parts: {
+ "word/document.xml":
+ 'As shown RU5ETk9URQ==(Smith 2020) earlier.',
+ },
+ expected: ["As shown (Smith 2020) earlier."],
+ absent: ["RU5ETk9URQ=="],
+ },
{
ext: "docx",
bounded: true,