2018-05-06 22:20:56 -05:00
|
|
|
// http://officeopenxml.com/WPhyperlink.php
|
2018-05-06 23:18:00 -05:00
|
|
|
|
2018-05-06 22:20:56 -05:00
|
|
|
import { XmlComponent } from "file/xml-components";
|
|
|
|
import { TextRun } from "../run";
|
|
|
|
import { HyperlinkAttributes } from "./hyperlink-attributes";
|
|
|
|
|
|
|
|
export class Hyperlink extends XmlComponent {
|
|
|
|
public linkId: number;
|
|
|
|
|
|
|
|
constructor(text: string, relationshipsCount: number) {
|
|
|
|
super("w:hyperlink");
|
|
|
|
|
|
|
|
this.linkId = relationshipsCount + 1;
|
2018-05-06 23:18:00 -05:00
|
|
|
const attributes = new HyperlinkAttributes({
|
2018-05-06 22:20:56 -05:00
|
|
|
id: `rId${this.linkId}`,
|
|
|
|
history: 1,
|
2018-05-06 23:18:00 -05:00
|
|
|
});
|
|
|
|
this.root.push(attributes);
|
2018-05-06 22:20:56 -05:00
|
|
|
this.root.push(new TextRun(text).style("Hyperlink"));
|
|
|
|
}
|
|
|
|
}
|