Skip to main content
Deno 2 is finally here 🎉️
Learn more
Module

x/docxml/mod.ts>RelationshipsXml

TypeScript (component) library for building and parsing a DOCX file
Latest
class RelationshipsXml
extends XmlFileWithContentTypes
import { RelationshipsXml } from "https://deno.land/x/docxml@5.15.3/mod.ts";

Constructors

new
RelationshipsXml(
location: string,
meta?: RelationshipMeta[],
instances?,
)

Properties

readonly
meta: Array<RelationshipMeta>

All relationship data

Methods

protected
toNode(): Document
add(type: RelationshipType, target: File | string): string

Create a new relationship and return the new identifier

addToArchive(archive: Archive): Promise<void>
ensureRelationship<C extends File>(type: RelationshipType, createInstance: () => C): C
filterInstances<R extends File = File>(cb: (meta: RelationshipMeta) => boolean): R[]
deprecated
find<R extends File = File>(cb: (meta: RelationshipMeta) => boolean): R | null
findInstance<R extends File = File>(cb: (meta: RelationshipMeta) => boolean): R | null

Find a relationship instance (eg. a DocumentXml) by its metadata. The metadata would tell you what type of relationship it is.

Get all XmlFile instances related to this one, including self. This helps the system serialize itself back to DOCX fullly. Probably not useful for consumers of the library.

By default only returns the instance itself but no other related instances.

getTarget(id: string)

Static Methods

fromArchive(
archive: Archive,
contentTypes: ContentTypesXml,
location: string,
): Promise<RelationshipsXml>

Instantiate this class by looking at the DOCX XML for it.