Skip to content

EPPlus

reference
1 min readUpdated

Kind: Service

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

Part of: Pams

NuGet package dependency

EPPlus is a NuGet package dependency referenced by the Pams API project. The API uses it when handling Excel workbook import or export operations, while clients interact with the resulting API endpoints rather than the package directly.

Diagram

mermaid
sequenceDiagram
    participant Client
    participant PamsAPI as Pams API
    participant EPPlus
    participant Workbook as Excel Workbook

    Client->>PamsAPI: Request spreadsheet export
    PamsAPI->>EPPlus: Create and populate workbook
    EPPlus->>Workbook: Generate XLSX content
    Workbook-->>EPPlus: Workbook bytes
    EPPlus-->>PamsAPI: Exported file content
    PamsAPI-->>Client: XLSX download response

Usage

ts
async function downloadPamsExport(): Promise<void> {
  const response = await fetch("/api/reports/export", {
    method: "GET",
    headers: {
      Accept: "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet",
    },
  });

  if (!response.ok) {
    throw new Error(`Export failed: ${response.status}`);
  }

  const workbook = await response.blob();
  const url = URL.createObjectURL(workbook);

  const link = document.createElement("a");
  link.href = url;
  link.download = "pams-export.xlsx";
  link.click();

  URL.revokeObjectURL(url);
}

AI Coding Instructions

  • Keep EPPlus-specific workbook creation, worksheet updates, and file serialization inside the Pams API project.
  • Return generated workbook content with the XLSX content type and a download filename.
  • Dispose workbook and stream resources after generating or reading spreadsheet content.
  • Validate uploaded spreadsheet content before reading worksheet values or mapping them to API models.

Used by

1 reference from 1 file. 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 (1)

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

Was this page helpful?

Download as PDF