NLdoc.Conversion.Reader.Docx.Files (NLdoc.Conversion.Reader.Docx v1.1.2)

View Source

This module provides functions to find specific files inside a Docx document.

TODO: write proper tests for this module:

  1. extract a regular Zip file from fixtures
  2. Docx.Files.read("path/to/extracted/zip")
  3. assert that the files are found correctly and the correct Docx.Files struct is returned
  4. assert that the Docx.Files struct can be used to find the correct files:
  • Docx.Files.document/1
  • Docx.Files.core_properties/1
  • Docx.Files.numberings/1
  • Docx.Files.styles/1
  • Docx.Files.relationships_of/2

Summary

Functions

Read the contents of a directory containing an unzipped Docx file and parse the [Content_Types].xml file to return a Docx.Files struct that can be used with the rest of the functions in this module.

Types

t()

@type t() :: %NLdoc.Conversion.Reader.Docx.Files{
  dir: String.t(),
  files: [String.t()],
  types: NLdoc.Conversion.Reader.Docx.Files.ContentTypes.t()
}

Functions

core_properties(files)

@spec core_properties(t()) :: [String.t()]

document(files)

@spec document(t()) :: String.t()

find_by_content_type(files, content_type)

@spec find_by_content_type(t(), String.t()) :: [String.t()]

numberings(files)

@spec numberings(t()) :: [String.t()]

read(dir)

@spec read(String.t()) :: t()

Read the contents of a directory containing an unzipped Docx file and parse the [Content_Types].xml file to return a Docx.Files struct that can be used with the rest of the functions in this module.

relationships_of(files, filepath)

@spec relationships_of(t(), filepath :: String.t()) :: String.t() | nil

styles(files)

@spec styles(t()) :: [String.t()]