Skip to content

DocumentFormat.OpenXml

reference
1 min readUpdated

Kind: Service

Source: Pams/HelperTool/HelperTool.csproj (line 1)

Part of: Pams

NuGet package dependency

DocumentFormat.OpenXml is a NuGet package dependency declared in Pams/HelperTool/HelperTool.csproj. HelperTool uses the package from .NET code to read, create, or update Open XML document packages such as Office files.

Diagram

mermaid
sequenceDiagram
    participant Caller
    participant HelperTool
    participant OpenXml as DocumentFormat.OpenXml
    participant Document

    Caller->>HelperTool: Start document operation
    HelperTool->>OpenXml: Open document package
    OpenXml->>Document: Read or write document parts
    Document-->>OpenXml: Return package content
    OpenXml-->>HelperTool: Return document result
    HelperTool-->>Caller: Complete operation

Usage

ts
import { spawn } from "node:child_process";

function runHelperTool(documentPath: string): Promise<void> {
  return new Promise((resolve, reject) => {
    const process = spawn(
      "dotnet",
      [
        "run",
        "--project",
        "Pams/HelperTool/HelperTool.csproj",
        "--",
        documentPath,
      ],
      { stdio: "inherit" },
    );

    process.on("error", reject);
    process.on("exit", (code) => {
      if (code === 0) {
        resolve();
      } else {
        reject(new Error(`HelperTool exited with code ${code}`));
      }
    });
  });
}

await runHelperTool("input.docx");

AI Coding Instructions

  • Keep DocumentFormat.OpenXml referenced through Pams/HelperTool/HelperTool.csproj.
  • Write Open XML document handling in the .NET HelperTool code; TypeScript callers should start the HelperTool process instead of importing the NuGet assembly.
  • Close document packages and streams after read or write operations so file handles are released.
  • Preserve document parts that the operation does not modify, including relationships and package metadata.

Used by

2 references from 2 files. Each is a place in this repository where the symbol is actually used — go read one rather than trusting an example.

Injected or called by (2)

  • Pams.APIPams/API/Pams.API/Pams.API.csproj:1
  • HelperToolPams/HelperTool/HelperTool.csproj:1

Was this page helpful?

Download as PDF