constructor()

in src-js/src/document.ts [461:489]


  constructor(block: ApiCellBlock, parentTable: Table) {
    super(block);
    const parentDocument = parentTable.parentPage.parentDocument;
    this._geometry = new Geometry(block.Geometry, this);
    this._content = [];
    this._parentTable = parentTable;
    this._text = "";
    (block.Relationships || []).forEach((rs) => {
      if (rs.Type == ApiRelationshipType.Child) {
        rs.Ids.forEach((cid) => {
          const childBlock = parentDocument.getBlockById(cid);
          if (!childBlock) {
            console.warn(`Document missing child block ${cid} referenced by table cell ${this.id}`);
            return;
          }
          const blockType = childBlock.BlockType;
          if (blockType == ApiBlockType.Word) {
            const w = new Word(childBlock as ApiWordBlock);
            this._content.push(w);
            this._text += w.text + " ";
          } else if (blockType == ApiBlockType.SelectionElement) {
            const se = new SelectionElement(childBlock as ApiSelectionElementBlock);
            this._content.push(se);
            this._text += se.selectionStatus + ", ";
          }
        });
      }
    });
  }