Files
docx-js/src/file/relationships/relationship/relationship.ts
Dolan 010ef05ce3 Feat/embedded fonts (#2174)
* #239 Embedded fonts

* Add boilerplate for font table

* Fix linting

* Fix linting

* Fix odttf naming

* Correct writing of fonts to relationships and font table

new uuid function

* Add font to run

* Add demo

Fix tests

* Add character set support

* Add tests

* Write tests
2023-12-30 02:23:54 +00:00

46 lines
2.1 KiB
TypeScript

import { XmlComponent } from "@file/xml-components";
import { RelationshipAttributes } from "./relationship-attributes";
export type RelationshipType =
| "http://schemas.openxmlformats.org/officeDocument/2006/relationships/image"
| "http://schemas.openxmlformats.org/officeDocument/2006/relationships/theme"
| "http://schemas.openxmlformats.org/officeDocument/2006/relationships/settings"
| "http://schemas.openxmlformats.org/officeDocument/2006/relationships/styles"
| "http://schemas.openxmlformats.org/officeDocument/2006/relationships/fontTable"
| "http://schemas.openxmlformats.org/officeDocument/2006/relationships/webSettings"
| "http://schemas.openxmlformats.org/officeDocument/2006/relationships/numbering"
| "http://schemas.openxmlformats.org/officeDocument/2006/relationships/header"
| "http://schemas.openxmlformats.org/officeDocument/2006/relationships/footer"
| "http://schemas.openxmlformats.org/officeDocument/2006/relationships/officeDocument"
| "http://schemas.openxmlformats.org/package/2006/relationships/metadata/core-properties"
| "http://schemas.openxmlformats.org/officeDocument/2006/relationships/custom-properties"
| "http://schemas.openxmlformats.org/officeDocument/2006/relationships/extended-properties"
| "http://schemas.openxmlformats.org/officeDocument/2006/relationships/hyperlink"
| "http://schemas.openxmlformats.org/officeDocument/2006/relationships/footnotes"
| "http://schemas.openxmlformats.org/officeDocument/2006/relationships/comments"
| "http://schemas.openxmlformats.org/officeDocument/2006/relationships/font";
export const TargetModeType = {
EXTERNAL: "External",
} as const;
export class Relationship extends XmlComponent {
public constructor(
id: string,
type: RelationshipType,
target: string,
targetMode?: (typeof TargetModeType)[keyof typeof TargetModeType],
) {
super("Relationship");
this.root.push(
new RelationshipAttributes({
id,
type,
target,
targetMode,
}),
);
}
}