hwpx-ts
Version:
TypeScript library for reading and writing HWPX files
1,150 lines (1,137 loc) • 30.3 kB
text/typescript
/**
* HWPX Document Type Definitions
* Comprehensive TypeScript types matching Python IR models (120+ types)
*/
type TextWrapType = 'top_and_bottom' | 'both_sides' | 'left_only' | 'right_only' | 'behind_text' | 'in_front_of_text';
type VertRelToType = 'paper' | 'page' | 'para';
type HorzRelToType = 'paper' | 'page' | 'column' | 'para';
type VertAlignType = 'top' | 'center' | 'bottom' | 'inside' | 'outside';
type HorzAlignType = 'left' | 'center' | 'right' | 'inside' | 'outside';
type CellVertAlignType = 'top' | 'center' | 'bottom';
type BorderStyleType = 'none' | 'solid' | 'dashed' | 'dotted' | 'double' | 'dash_dot' | 'dash_dot_dot';
type HwpxBorderType = 'NONE' | 'SOLID' | 'DASH' | 'DOT' | 'DASH_DOT' | 'DASH_DOT_DOT' | 'DOUBLE_SLIM' | 'THICK_SLIM' | 'SLIM_THICK' | 'THICK_SLIM_THICK' | 'SLIM_THICK_SLIM' | 'WAVE' | 'DOUBLE_WAVE' | 'LONG_DASH' | 'INSET' | 'OUTSET';
type DiagonalType = 'NONE' | 'SLASH' | 'BACKSLASH' | 'CENTER';
type AlignmentType = 'left' | 'right' | 'center' | 'justify' | 'distribute';
type LineSpacingType = 'percent' | 'fixed' | 'between_lines' | 'at_least';
type BlockType = 'paragraph' | 'table' | 'image' | 'section' | 'equation' | 'list' | 'toc';
type ListType = 'bullet' | 'numbered' | 'checklist' | 'multi_level';
type BulletStyle = 'disc' | 'circle' | 'square' | 'dash' | 'arrow' | 'check';
type NumberingStyle = 'decimal' | 'lower_alpha' | 'upper_alpha' | 'lower_roman' | 'upper_roman' | 'korean' | 'circled';
type FieldType = 'date' | 'time' | 'page_number' | 'total_pages' | 'file_name' | 'author' | 'title' | 'created_date' | 'modified_date' | 'custom';
type ChangeType = 'insert' | 'delete' | 'format';
type PageNumFormatType = 'digit' | 'upper_roman' | 'lower_roman' | 'upper_alpha' | 'lower_alpha';
type PageNumPosType = 'top_left' | 'top_center' | 'top_right' | 'bottom_left' | 'bottom_center' | 'bottom_right';
/** HWPX native border definition */
interface IrHwpxBorder {
type: HwpxBorderType;
width: string;
color: string;
}
/** Diagonal definition */
interface IrDiagonal {
type: DiagonalType;
crooked: boolean;
isCounter: boolean;
}
/** Windows brush fill */
interface IrWinBrush {
faceColor: string;
hatchColor: string;
alpha: number;
}
/** Gradation fill */
interface IrGradation {
type: string;
angle: number;
centerX: number;
centerY: number;
step: number;
colorNum: number;
stepCenter: number;
colors: string[];
}
/** Fill brush (winBrush or gradation) */
interface IrFillBrush {
winBrush?: IrWinBrush;
gradation?: IrGradation;
}
/** HWPX BorderFill definition (for header.xml) */
interface IrBorderFillDef {
id: number;
threeD: boolean;
shadow: boolean;
centerLine: string;
breakCellSeparateLine: boolean;
slash?: IrDiagonal;
backSlash?: IrDiagonal;
leftBorder?: IrHwpxBorder;
rightBorder?: IrHwpxBorder;
topBorder?: IrHwpxBorder;
bottomBorder?: IrHwpxBorder;
diagonal?: IrHwpxBorder;
fillBrush?: IrFillBrush;
}
/** Font definition */
interface IrFontDef {
id: number;
face: string;
type: string;
isEmbedded: boolean;
substFontFace?: string;
}
/** Font face per language */
interface IrFontFace {
lang: string;
fonts: IrFontDef[];
}
/** Font reference (font ID per language) */
interface IrFontRef {
hangul: number;
latin: number;
hanja: number;
japanese: number;
other: number;
symbol: number;
user: number;
}
/** Language values (ratio, spacing, relSz, offset) */
interface IrLangValues {
hangul: number;
latin: number;
hanja: number;
japanese: number;
other: number;
symbol: number;
user: number;
}
/** Underline settings */
interface IrUnderline {
type: string;
shape: string;
color: string;
}
/** Strikeout settings */
interface IrStrikeout {
shape: string;
color: string;
}
/** Shadow settings */
interface IrShadow {
type: string;
color: string;
offsetX: number;
offsetY: number;
}
/** Character property definition (for header.xml) */
interface IrCharPrDef {
id: number;
height: number;
textColor: string;
shadeColor: string;
useFontSpace: boolean;
useKerning: boolean;
symMark: string;
borderFillIdRef: number;
fontRef?: IrFontRef;
ratio?: IrLangValues;
spacing?: IrLangValues;
relSz?: IrLangValues;
offset?: IrLangValues;
bold: boolean;
italic: boolean;
underline?: IrUnderline;
strikeout?: IrStrikeout;
outlineType: string;
shadow?: IrShadow;
}
/** Paragraph alignment */
interface IrParaAlign {
horizontal: string;
vertical: string;
}
/** Break settings */
interface IrBreakSetting {
breakLatinWord: string;
breakNonLatinWord: string;
widowOrphan: boolean;
keepWithNext: boolean;
keepLines: boolean;
pageBreakBefore: boolean;
lineWrap: string;
}
/** Paragraph border */
interface IrParaBorder {
borderFillIdRef: number;
offsetLeft: number;
offsetRight: number;
offsetTop: number;
offsetBottom: number;
connect: boolean;
ignoreMargin: boolean;
}
/** Paragraph property definition (for header.xml) */
interface IrParaPrDef {
id: number;
tabPrIdRef: number;
condense: number;
fontLineHeight: boolean;
snapToGrid: boolean;
suppressLineNumbers: boolean;
checked: boolean;
align?: IrParaAlign;
breakSetting?: IrBreakSetting;
border?: IrParaBorder;
marginLeft: number;
marginRight: number;
indent: number;
lineSpacingType: string;
lineSpacingValue: number;
}
/** Margin (HWPUNIT) */
interface IrMargin {
left: number;
right: number;
top: number;
bottom: number;
}
/** Position settings */
interface IrPosition {
treatAsChar: boolean;
vertRelTo: VertRelToType;
horzRelTo: HorzRelToType;
vertAlign: VertAlignType;
horzAlign: HorzAlignType;
vertOffset: number;
horzOffset: number;
flowWithText: boolean;
allowOverlap: boolean;
}
/** Border */
interface IrBorder {
style: BorderStyleType;
width: number;
color: string;
}
/** 4-direction borders */
interface IrBorderSet {
left?: IrBorder;
right?: IrBorder;
top?: IrBorder;
bottom?: IrBorder;
}
/** Text run */
interface IrTextRun {
text: string;
bold?: boolean;
italic?: boolean;
underline?: boolean;
strikethrough?: boolean;
fontSize?: number;
fontFamily?: string;
color?: string;
backgroundColor?: string;
}
/** Line break */
interface IrLineBreak {
type: 'line_break';
}
/** Tab character */
interface IrTab {
type: 'tab';
}
/** Hyperlink */
interface IrHyperlink {
url: string;
text: string;
tooltip?: string;
}
/** Bookmark */
interface IrBookmark {
name: string;
text?: string;
}
/** Field (auto-insert element) */
interface IrField {
fieldType: FieldType;
format?: string;
customValue?: string;
}
/** Footnote */
interface IrFootnote {
number: number;
content: IrParagraph[];
}
/** Endnote */
interface IrEndnote {
number: number;
content: IrParagraph[];
}
/** Comment/memo */
interface IrComment {
author: string;
content: string;
date?: string;
}
/** Track change */
interface IrTrackChange {
changeType: ChangeType;
author: string;
date?: string;
originalText?: string;
newText?: string;
}
/** Inline equation */
interface IrInlineEquation {
script: string;
baseLine: number;
}
type IrInline = IrTextRun | IrLineBreak | IrTab | IrHyperlink | IrBookmark | IrField | IrFootnote | IrEndnote | IrComment | IrTrackChange | IrInlineEquation;
/** Paragraph */
interface IrParagraph {
inlines: IrInline[];
rawXml?: Uint8Array;
alignment?: AlignmentType;
lineSpacingType?: LineSpacingType;
lineSpacingValue?: number;
indentLeft?: number;
indentRight?: number;
indentFirstLine?: number;
spaceBefore?: number;
spaceAfter?: number;
backgroundColor?: string;
styleId?: string;
}
/** Image */
interface IrImage {
imageId: string;
widthHwpunit?: number;
heightHwpunit?: number;
orgWidth?: number;
orgHeight?: number;
treatAsChar?: boolean;
position?: IrPosition;
textWrap?: TextWrapType;
outMargin?: IrMargin;
flipHorizontal?: boolean;
flipVertical?: boolean;
rotationAngle?: number;
brightness?: number;
contrast?: number;
alpha?: number;
rawXml?: Uint8Array;
}
/** Table cell */
interface IrTableCell {
row: number;
col: number;
rowSpan?: number;
colSpan?: number;
blocks: IrBlock[];
widthHwpunit?: number;
heightHwpunit?: number;
margin?: IrMargin;
vertAlign?: CellVertAlignType;
borderFillId?: number;
borders?: IrBorderSet;
backgroundColor?: string;
protect?: boolean;
}
/** Table */
interface IrTable {
rowCnt: number;
colCnt: number;
cells: IrTableCell[];
widthHwpunit?: number;
heightHwpunit?: number;
colWidths?: number[];
rowHeights?: number[];
treatAsChar?: boolean;
position?: IrPosition;
textWrap?: TextWrapType;
outMargin?: IrMargin;
inMargin?: IrMargin;
cellSpacing?: number;
borderFillId?: number;
repeatHeader?: boolean;
rawXml?: Uint8Array;
}
/** Equation */
interface IrEquation {
script: string;
widthHwpunit?: number;
heightHwpunit?: number;
textColor?: string;
baseLine?: number;
version?: string;
}
/** List item */
interface IrListItem {
content: IrParagraph;
level: number;
listType: ListType;
bulletStyle?: BulletStyle;
numberingStyle?: NumberingStyle;
number?: number;
checked?: boolean;
}
/** List */
interface IrList {
items: IrListItem[];
listType: ListType;
startNumber?: number;
}
/** Caption (for table/image) */
interface IrCaption {
text: string;
targetType: 'table' | 'image' | 'equation';
number?: number;
position: 'above' | 'below';
prefix?: string;
}
/** TOC entry */
interface IrTOCEntry {
text: string;
level: number;
pageNumber?: number;
bookmarkName?: string;
}
/** Table of Contents */
interface IrTOC {
entries: IrTOCEntry[];
title: string;
maxLevel: number;
showPageNumbers: boolean;
useHyperlinks: boolean;
}
/** Page margin (HWPUNIT) */
interface IrPageMargin {
left: number;
right: number;
top: number;
bottom: number;
header: number;
footer: number;
gutter: number;
}
/** Header */
interface IrHeader {
text: string;
height: number;
}
/** Footer */
interface IrFooter {
text: string;
height: number;
showPageNumber?: boolean;
}
/** Page number settings */
interface IrPageNumber {
position: PageNumPosType;
formatType: PageNumFormatType;
startNumber: number;
hideFirstPage: boolean;
sideChar: string;
}
/** Page hiding settings */
interface IrPageHiding {
hideHeader: boolean;
hideFooter: boolean;
hideMasterPage: boolean;
hideBorder: boolean;
hideFill: boolean;
hidePageNum: boolean;
}
/** Section (page settings unit) */
interface IrSection {
blocks: IrBlock[];
colCount?: number;
colGap?: number;
colLineType?: string;
header?: IrHeader;
footer?: IrFooter;
pageWidth?: number;
pageHeight?: number;
landscape?: boolean;
margin?: IrPageMargin;
pageNumber?: IrPageNumber;
pageHiding?: IrPageHiding;
rawXml?: Uint8Array;
}
/** Block element */
interface IrBlock {
type: BlockType;
paragraph?: IrParagraph;
table?: IrTable;
image?: IrImage;
section?: IrSection;
equation?: IrEquation;
list?: IrList;
toc?: IrTOC;
caption?: IrCaption;
pageBreak?: boolean;
}
/** Document */
interface IrDocument {
blocks: IrBlock[];
}
/** Binary item (image, etc.) */
interface IrBinaryItem {
id: string;
href: string;
mediaType: string;
isEmbedded?: boolean;
data?: Uint8Array;
}
/** Style definition */
interface IrStyleDef {
id: number;
type: string;
name: string;
engName: string;
paraPrIdRef: number;
charPrIdRef: number;
nextStyleIdRef: number;
langId: number;
}
/** Tab item */
interface IrTabItem {
pos: number;
type: string;
leader: string;
}
/** Tab property definition */
interface IrTabPrDef {
id: number;
autoTabLeft: boolean;
autoTabRight: boolean;
tabs: IrTabItem[];
}
/** Numbering definition */
interface IrNumberingDef {
id: number;
start: number;
levels: string[];
}
/** Bullet definition */
interface IrBulletDef {
id: number;
char: string;
charPrIdRef: number;
}
/** header.xml complete definition */
interface IrHeaderXmlDef {
version: string;
secCnt: number;
beginPage: number;
beginFootnote: number;
beginEndnote: number;
beginPic: number;
beginTbl: number;
beginEquation: number;
fontFaces: IrFontFace[];
borderFills: IrBorderFillDef[];
charProperties: IrCharPrDef[];
tabProperties: IrTabPrDef[];
numberings: IrNumberingDef[];
bullets: IrBulletDef[];
paraProperties: IrParaPrDef[];
styles: IrStyleDef[];
binaryItems: IrBinaryItem[];
rawXml?: Uint8Array;
}
/** Document metadata */
interface IrDocumentMeta {
title: string;
language: string;
creator: string;
subject: string;
description: string;
lastSavedBy: string;
createdDate: string;
modifiedDate: string;
date: string;
keyword: string;
}
/** Manifest item */
interface IrManifestItem {
id: string;
href: string;
mediaType: string;
isEmbedded?: boolean;
}
/** Spine item (reading order) */
interface IrSpineItem {
idref: string;
linear: boolean;
}
/** content.hpf complete definition */
interface IrContentHpf {
metadata: IrDocumentMeta;
manifestItems: IrManifestItem[];
spineItems: IrSpineItem[];
rawXml?: Uint8Array;
}
/** Caret position */
interface IrCaretPosition {
listIdRef: number;
paraIdRef: number;
pos: number;
}
/** settings.xml definition */
interface IrSettings {
caretPosition?: IrCaretPosition;
rawXml?: Uint8Array;
}
/** version.xml definition */
interface IrVersion {
targetApplication: string;
major: number;
minor: number;
micro: number;
buildNumber: number;
os: number;
xmlVersion: string;
application: string;
appVersion: string;
rawXml?: Uint8Array;
}
/** Memo item */
interface IrMemoItem {
id: number;
parentId: number;
}
/** memoExtended.xml definition */
interface IrMemoExtended {
memos: IrMemoItem[];
rawXml?: Uint8Array;
}
/** Root file reference */
interface IrRootFile {
fullPath: string;
mediaType: string;
}
/** META-INF/container.xml definition */
interface IrContainerXml {
rootFiles: IrRootFile[];
rawXml?: Uint8Array;
}
/** META-INF/container.rdf definition */
interface IrContainerRdf {
rawXml?: Uint8Array;
}
/** META-INF/manifest.xml definition */
interface IrManifestXml {
rawXml?: Uint8Array;
}
/** Complete HWPX Package */
interface IrHwpxPackage {
document: IrDocument;
headerXml?: IrHeaderXmlDef;
contentHpf?: IrContentHpf;
settings?: IrSettings;
version?: IrVersion;
memoExtended?: IrMemoExtended;
containerXml?: IrContainerXml;
containerRdf?: IrContainerRdf;
manifestXml?: IrManifestXml;
binaryItems: IrBinaryItem[];
}
/** Search result */
interface SearchResult {
paragraphIndex: number;
text: string;
startPos?: number;
endPos?: number;
matchedText?: string;
matchCount?: number;
}
/** Document info */
interface DocumentInfo {
paragraphCount: number;
tableCount: number;
imageCount: number;
sectionCount: number;
estimatedPageCount?: number;
binaryItemCount?: number;
binaryItems?: number;
}
/** Simple inline text run for reader */
interface TextRun {
text: string;
bold?: boolean;
italic?: boolean;
underline?: boolean;
strikethrough?: boolean;
charStyleId?: number;
fontSize?: number;
fontFace?: string;
color?: string;
}
/** Simple line break for reader */
interface LineBreak {
type: 'line_break';
}
/** Simple tab for reader */
interface Tab {
type: 'tab';
}
/** Inline element union type */
type InlineElement = TextRun | LineBreak | Tab;
/** Simple paragraph for reader */
interface Paragraph {
inlines: InlineElement[];
alignment?: string;
paraStyleId?: number;
lineSpacing?: number;
}
/** Simple table cell for reader */
interface TableCell {
row: number;
col: number;
rowSpan?: number;
colSpan?: number;
blocks: Block[];
width?: number;
height?: number;
}
/** Simple table for reader */
interface Table {
rowCount: number;
colCount: number;
cells: TableCell[];
colWidths?: number[];
rowHeights?: number[];
repeatHeader?: boolean;
}
/** Simple image for reader */
interface Image {
imageId: string;
width?: number;
height?: number;
mediaType?: string;
}
/** Simple block union for reader */
interface Block {
type: BlockType | string;
paragraph?: Paragraph;
table?: Table;
image?: Image;
pageBreak?: boolean;
sectionBreak?: boolean;
}
/** Simple binary item for reader */
interface BinaryItem {
id: string;
href: string;
mediaType: string;
data?: Uint8Array;
isEmbedded?: boolean;
}
/** Simple document structure for reader */
interface HwpxDocument {
blocks: Block[];
binaryItems: BinaryItem[];
}
/**
* HWPX Constants and Unit Conversions
*/
declare const NS: {
readonly ha: "http://www.hancom.co.kr/hwpml/2011/app";
readonly hp: "http://www.hancom.co.kr/hwpml/2011/paragraph";
readonly hp10: "http://www.hancom.co.kr/hwpml/2016/paragraph";
readonly hs: "http://www.hancom.co.kr/hwpml/2011/section";
readonly hc: "http://www.hancom.co.kr/hwpml/2011/core";
readonly hh: "http://www.hancom.co.kr/hwpml/2011/head";
readonly hpf: "http://www.hancom.co.kr/schema/2011/hpf";
readonly opf: "http://www.idpf.org/2007/opf/";
};
declare const HWPUNIT_PER_INCH = 1440;
declare const HWPUNIT_PER_MM = 56.7;
declare const HWPUNIT_PER_PT = 20;
declare const A4_WIDTH = 59528;
declare const A4_HEIGHT = 84188;
declare const HWPX_MIMETYPE = "application/hwp+zip";
/**
* Convert millimeters to HWPUNIT
*/
declare function mmToHwpunit(mm: number): number;
/**
* Convert HWPUNIT to millimeters
*/
declare function hwpunitToMm(hwpunit: number): number;
/**
* Convert points to HWPUNIT
*/
declare function ptToHwpunit(pt: number): number;
/**
* Convert HWPUNIT to points
*/
declare function hwpunitToPt(hwpunit: number): number;
/**
* Guess media type from filename
*/
declare function guessMediaType(filename: string): string;
/**
* Convert HEX color to HWPX format
*/
declare function hexColorToHwpx(color: string): string;
/**
* HWPX Reader - TypeScript implementation
*/
interface HwpxReaderOptions {
parseRawXml?: boolean;
}
declare class HwpxReader {
private data;
private document;
private headerXml;
private sectionXmls;
private binaryData;
private parser;
constructor(data: Uint8Array | ArrayBuffer, options?: HwpxReaderOptions);
/**
* Parse the HWPX file
*/
parse(): Promise<HwpxDocument>;
/**
* Parse a section XML
*/
private parseSection;
/**
* Recursively find and parse paragraphs
*/
private parseParagraphs;
/**
* Parse a paragraph element
*/
private parseParagraph;
/**
* Parse a table element
*/
private parseTable;
/**
* Find elements by tag names
*/
private findElements;
/**
* Get full text content
*/
getText(): string;
/**
* Get all paragraphs
*/
getParagraphs(): Paragraph[];
/**
* Get paragraph by index
*/
getParagraph(index: number): Paragraph | null;
/**
* Get paragraph text by index
*/
getParagraphText(index: number): string;
/**
* Get all tables
*/
getTables(): Table[];
/**
* Get all images
*/
getImages(): Image[];
/**
* Get image binary data
*/
getImageData(imageId: string): Uint8Array | null;
/**
* Get document info
*/
getInfo(): DocumentInfo;
/**
* Search text in document
*/
search(query: string, caseSensitive?: boolean): SearchResult[];
/**
* Convert to JSON
*/
toJson(): string;
/**
* Convert to Markdown
*/
toMarkdown(): string;
/**
* Get the parsed document
*/
getDocument(): HwpxDocument;
}
/**
* Read HWPX from file (Node.js)
*/
declare function readHwpxFile(filePath: string): Promise<HwpxReader>;
/**
* Read HWPX from URL (Browser)
*/
declare function readHwpxUrl(url: string): Promise<HwpxReader>;
/**
* HWPX Exporter - TypeScript implementation
*/
interface HwpxExporterOptions {
template?: Uint8Array;
}
declare class HwpxExporter {
private document;
private binaryItems;
private imageCounter;
private tableCounter;
private paraCounter;
private templateData;
private xmlBuilder;
constructor(options?: HwpxExporterOptions);
/**
* Load template HWPX
*/
private loadTemplate;
/**
* Add a paragraph
*/
addParagraph(text: string, options?: {
alignment?: AlignmentType;
bold?: boolean;
italic?: boolean;
fontSize?: number;
color?: string;
}): this;
/**
* Add a heading
*/
addHeading(text: string, level?: number, alignment?: AlignmentType): this;
/**
* Add a table
*/
addTable(data: string[][], options?: {
header?: boolean;
colWidths?: number[];
}): this;
/**
* Add an image
*/
addImage(imageData: Uint8Array, filename?: string, options?: {
widthMm?: number;
heightMm?: number;
}): this;
/**
* Add a page break
*/
addPageBreak(): this;
/**
* Add a line break (empty paragraph)
*/
addLineBreak(): this;
/**
* Create from Markdown text
*/
fromMarkdown(markdown: string): this;
/**
* Build HWPX as Uint8Array
*/
build(): Promise<Uint8Array>;
/**
* Build section XML
*/
private buildSectionXml;
/**
* Build paragraph XML object
*/
private buildParagraphXml;
/**
* Build table XML object
*/
private buildTableXml;
/**
* Build image XML object
*/
private buildImageXml;
/**
* Get default file content
*/
private getDefaultFileContent;
/**
* Save to file (Node.js)
*/
saveToFile(filePath: string): Promise<void>;
/**
* Get the document
*/
getDocument(): HwpxDocument;
}
/**
* Editor type definitions
*/
interface InsertTableOptions {
data?: string[][];
colWidths?: number[];
borderFillId?: number;
}
interface InsertParagraphOptions {
paraPrId?: number;
charPrId?: number;
}
interface InsertImageOptions {
binaryItemId: string;
width: number;
height: number;
}
/**
* HWPX Editor - TypeScript implementation
* Provides editing capabilities for existing HWPX documents
*/
/**
* HwpxEditor - Edit existing HWPX section XML
*/
declare class HwpxEditor {
private originalXml;
private xmlStr;
private useRawMode;
private root;
private modified;
private parser;
private builder;
constructor(sectionXml: Uint8Array | string);
/**
* Check if document has been modified
*/
isModified(): boolean;
/**
* Export as Uint8Array
*/
toBytes(): Uint8Array;
/**
* Export as string
*/
toString(): string;
private getParagraphs;
/**
* Get paragraph count
*/
getParagraphCount(): number;
/**
* Get paragraph text by index
*/
getParagraphText(index: number): string | null;
/**
* Replace text in document (string-based, safe mode)
*/
replaceText(oldText: string, newText: string, count?: number): number;
/**
* Insert paragraph after specific index
*/
insertParagraphAfter(afterIndex: number, text: string, options?: InsertParagraphOptions): boolean;
/**
* Insert paragraph before specific index
*/
insertParagraphBefore(beforeIndex: number, text: string, options?: InsertParagraphOptions): boolean;
/**
* Append paragraph at document end
*/
appendParagraph(text: string, options?: InsertParagraphOptions): boolean;
/**
* Insert table after specific paragraph
*/
insertTableAfter(afterIndex: number, rows: number, cols: number, options?: InsertTableOptions): boolean;
/**
* Append table at document end
*/
appendTable(rows: number, cols: number, options?: InsertTableOptions): boolean;
/**
* Insert image after specific paragraph
*/
insertImageAfter(afterIndex: number, options: InsertImageOptions): boolean;
/**
* Append image at document end
*/
appendImage(options: InsertImageOptions): boolean;
/**
* Delete paragraph by index
*/
deleteParagraph(index: number): boolean;
/**
* Delete paragraphs in range
*/
deleteParagraphsRange(start: number, end: number): number;
/**
* Copy paragraph from one index to another
*/
copyParagraph(fromIndex: number, toIndex: number): boolean;
/**
* Move paragraph from one index to another
*/
moveParagraph(fromIndex: number, toIndex: number): boolean;
/**
* Set paragraph text (replace all runs in paragraph)
*/
setParagraphText(index: number, text: string, charPrId?: number): boolean;
/**
* Set page break for paragraph
*/
setPageBreak(index: number, enable?: boolean): boolean;
/**
* Set column break for paragraph
*/
setColumnBreak(index: number, enable?: boolean): boolean;
/**
* Set paragraph style ID
*/
setParagraphStyle(index: number, paraPrId: number): boolean;
/**
* Set character style for all runs in paragraph
*/
setCharStyle(paraIndex: number, charPrId: number): boolean;
/**
* Insert paragraph after paragraph containing specific text
* (String-based, safe mode)
*/
insertParagraphAfterText(afterText: string, newText: string, options?: InsertParagraphOptions): boolean;
/**
* Append paragraph at document end (before </hs:sec>)
* (String-based, safe mode)
*/
appendParagraphRaw(text: string, options?: InsertParagraphOptions): boolean;
/**
* Insert multiple paragraphs after paragraph containing specific text
* (String-based, safe mode)
*/
insertParagraphsAfterText(afterText: string, texts: string[], options?: InsertParagraphOptions): number;
/**
* Copy style from existing paragraph and insert new paragraph
* (String-based, safe mode)
*/
copyParagraphStyleAndInsert(sourceText: string, newText: string): boolean;
}
/**
* Paragraph builder functions
*/
/**
* Create paragraph object for XML builder
*/
declare function createParagraphObject(text: string, paraPrId: number, charPrId: number): any;
/**
* Create paragraph XML string for string-based insertion
*/
declare function createParagraphXml(text: string, paraPrId: number, charPrId: number): string;
/**
* Table builder functions
*/
/**
* Create table cell object
*/
declare function createTableCell(row: number, col: number, width: number, height: number, text: string, borderFillId: number): any;
/**
* Create table paragraph object
*/
declare function createTableParagraph(rows: number, cols: number, data?: string[][], colWidths?: number[], borderFillId?: number): any;
/**
* Image builder functions
*/
/**
* Create image paragraph object
*/
declare function createImageParagraph(binaryItemId: string, width: number, height: number): any;
export { A4_HEIGHT, A4_WIDTH, type AlignmentType, type BinaryItem, type Block, type BlockType, type BorderStyleType, type BulletStyle, type CellVertAlignType, type ChangeType, type DiagonalType, type DocumentInfo, type FieldType, HWPUNIT_PER_INCH, HWPUNIT_PER_MM, HWPUNIT_PER_PT, HWPX_MIMETYPE, type HorzAlignType, type HorzRelToType, type HwpxBorderType, type HwpxDocument, HwpxEditor, HwpxExporter, type HwpxExporterOptions, HwpxReader, type HwpxReaderOptions, type Image, type InlineElement, type InsertImageOptions, type InsertParagraphOptions, type InsertTableOptions, type IrBinaryItem, type IrBlock, type IrBookmark, type IrBorder, type IrBorderFillDef, type IrBorderSet, type IrBreakSetting, type IrBulletDef, type IrCaption, type IrCaretPosition, type IrCharPrDef, type IrComment, type IrContainerRdf, type IrContainerXml, type IrContentHpf, type IrDiagonal, type IrDocument, type IrDocumentMeta, type IrEndnote, type IrEquation, type IrField, type IrFillBrush, type IrFontDef, type IrFontFace, type IrFontRef, type IrFooter, type IrFootnote, type IrGradation, type IrHeader, type IrHeaderXmlDef, type IrHwpxBorder, type IrHwpxPackage, type IrHyperlink, type IrImage, type IrInline, type IrInlineEquation, type IrLangValues, type IrLineBreak, type IrList, type IrListItem, type IrManifestItem, type IrManifestXml, type IrMargin, type IrMemoExtended, type IrMemoItem, type IrNumberingDef, type IrPageHiding, type IrPageMargin, type IrPageNumber, type IrParaAlign, type IrParaBorder, type IrParaPrDef, type IrParagraph, type IrPosition, type IrRootFile, type IrSection, type IrSettings, type IrShadow, type IrSpineItem, type IrStrikeout, type IrStyleDef, type IrTOC, type IrTOCEntry, type IrTab, type IrTabItem, type IrTabPrDef, type IrTable, type IrTableCell, type IrTextRun, type IrTrackChange, type IrUnderline, type IrVersion, type IrWinBrush, type LineBreak, type LineSpacingType, type ListType, NS, type NumberingStyle, type PageNumFormatType, type PageNumPosType, type Paragraph, type SearchResult, type Tab, type Table, type TableCell, type TextRun, type TextWrapType, type VertAlignType, type VertRelToType, createImageParagraph, createParagraphObject, createParagraphXml, createTableCell, createTableParagraph, guessMediaType, hexColorToHwpx, hwpunitToMm, hwpunitToPt, mmToHwpunit, ptToHwpunit, readHwpxFile, readHwpxUrl };