OpenWord 1.0.0
Modern C++17 library for parsing, manipulating, and saving DOCX files.
Loading...
Searching...
No Matches
Public Member Functions | List of all members
openword::Paragraph Class Reference

#include <Document.h>

Public Member Functions

 Paragraph (void *node)
 
Run addRun (const std::string &text="")
 
void addRawXml (const std::string &xml)
 
Run addPageNumber ()
 Injects a dynamic PAGE field code to display the current page number.
 
Run addTotalPages ()
 Injects a dynamic NUMPAGES field code to display the total document page count.
 
void addImage (gsl::czstring image_path, double scale=1.0, ImagePosition position=ImagePosition::Inline, long long xOffset=0, long long yOffset=0)
 Adds an image to the paragraph.
 
void addEquation (const std::string &omml)
 Adds a raw OMML (Office Math Markup Language) equation to the paragraph.
 
ParagraphsetStyle (gsl::czstring styleId)
 
ParagraphsetOutlineLevel (int level)
 
ParagraphsetAlignment (gsl::czstring align)
 
ParagraphsetSpacing (int beforeTwips, int afterTwips, int lineSpacing=-1, gsl::czstring lineRule="auto")
 
ParagraphsetIndentation (int leftTwips, int rightTwips, int firstLineTwips=0, int hangingTwips=0)
 
ParagraphsetList (int numId, int level=0)
 
ParagraphsetBorders (const BorderSettings &top, const BorderSettings &bottom, const BorderSettings &left, const BorderSettings &right)
 
ParagraphsetBorders (const BorderSettings &all)
 
ParagraphsetShading (const std::string &hexColor)
 
TextBox addTextBox (long long widthEMU, long long heightEMU, long long xOffsetEMU=0, long long yOffsetEMU=0)
 
Run addHyperlink (gsl::czstring text, gsl::czstring url)
 
Run addInternalLink (gsl::czstring text, gsl::czstring bookmarkName)
 
void insertBookmark (gsl::czstring name)
 
void addFootnoteReference (int footnoteId)
 
void addEndnoteReference (int endnoteId)
 
Section appendSectionBreak ()
 
std::string styleId () const
 
std::string alignment () const
 
bool isList () const
 
int listLevel () const
 
std::vector< Runruns () const
 
std::string text () const
 
int replaceText (const std::string &search, const std::string &replace)
 
void remove ()
 
Paragraph cloneAfter ()
 
Paragraph insertParagraphAfter (const std::string &text="")
 
Table insertTableAfter (int rows, int cols)
 

Constructor & Destructor Documentation

◆ Paragraph()

openword::Paragraph::Paragraph ( void *  node)
explicit

Member Function Documentation

◆ addEndnoteReference()

void openword::Paragraph::addEndnoteReference ( int  endnoteId)

◆ addEquation()

void openword::Paragraph::addEquation ( const std::string &  omml)

Adds a raw OMML (Office Math Markup Language) equation to the paragraph.

Parameters
ommlThe raw OMML XML string.

◆ addFootnoteReference()

void openword::Paragraph::addFootnoteReference ( int  footnoteId)

◆ addHyperlink()

Run openword::Paragraph::addHyperlink ( gsl::czstring  text,
gsl::czstring  url 
)

◆ addImage()

void openword::Paragraph::addImage ( gsl::czstring  image_path,
double  scale = 1.0,
ImagePosition  position = ImagePosition::Inline,
long long  xOffset = 0,
long long  yOffset = 0 
)

Adds an image to the paragraph.

Parameters
image_pathPath to the image file (JPEG or PNG).
scaleOptional scaling factor (e.g., 0.5 for half size, 2.0 for double size). Default is 1.0.
positionDefines how the image is positioned relative to text.
xOffsetOptional horizontal offset in EMU (English Metric Units). Only applicable if not Inline.
yOffsetOptional vertical offset in EMU (English Metric Units). Only applicable if not Inline.

◆ addInternalLink()

Run openword::Paragraph::addInternalLink ( gsl::czstring  text,
gsl::czstring  bookmarkName 
)

◆ addPageNumber()

Run openword::Paragraph::addPageNumber ( )

Injects a dynamic PAGE field code to display the current page number.

Returns
The Run containing the field.

◆ addRawXml()

void openword::Paragraph::addRawXml ( const std::string &  xml)

◆ addRun()

Run openword::Paragraph::addRun ( const std::string &  text = "")

◆ addTextBox()

TextBox openword::Paragraph::addTextBox ( long long  widthEMU,
long long  heightEMU,
long long  xOffsetEMU = 0,
long long  yOffsetEMU = 0 
)

◆ addTotalPages()

Run openword::Paragraph::addTotalPages ( )

Injects a dynamic NUMPAGES field code to display the total document page count.

Returns
The Run containing the field.

◆ alignment()

std::string openword::Paragraph::alignment ( ) const

◆ appendSectionBreak()

Section openword::Paragraph::appendSectionBreak ( )

◆ cloneAfter()

Paragraph openword::Paragraph::cloneAfter ( )

◆ insertBookmark()

void openword::Paragraph::insertBookmark ( gsl::czstring  name)

◆ insertParagraphAfter()

Paragraph openword::Paragraph::insertParagraphAfter ( const std::string &  text = "")

◆ insertTableAfter()

Table openword::Paragraph::insertTableAfter ( int  rows,
int  cols 
)

◆ isList()

bool openword::Paragraph::isList ( ) const

◆ listLevel()

int openword::Paragraph::listLevel ( ) const

◆ remove()

void openword::Paragraph::remove ( )

◆ replaceText()

int openword::Paragraph::replaceText ( const std::string &  search,
const std::string &  replace 
)

◆ runs()

std::vector< Run > openword::Paragraph::runs ( ) const

◆ setAlignment()

Paragraph & openword::Paragraph::setAlignment ( gsl::czstring  align)

◆ setBorders() [1/2]

Paragraph & openword::Paragraph::setBorders ( const BorderSettings all)

◆ setBorders() [2/2]

Paragraph & openword::Paragraph::setBorders ( const BorderSettings top,
const BorderSettings bottom,
const BorderSettings left,
const BorderSettings right 
)

◆ setIndentation()

Paragraph & openword::Paragraph::setIndentation ( int  leftTwips,
int  rightTwips,
int  firstLineTwips = 0,
int  hangingTwips = 0 
)

◆ setList()

Paragraph & openword::Paragraph::setList ( int  numId,
int  level = 0 
)

◆ setOutlineLevel()

Paragraph & openword::Paragraph::setOutlineLevel ( int  level)

◆ setShading()

Paragraph & openword::Paragraph::setShading ( const std::string &  hexColor)

◆ setSpacing()

Paragraph & openword::Paragraph::setSpacing ( int  beforeTwips,
int  afterTwips,
int  lineSpacing = -1,
gsl::czstring  lineRule = "auto" 
)

◆ setStyle()

Paragraph & openword::Paragraph::setStyle ( gsl::czstring  styleId)

◆ styleId()

std::string openword::Paragraph::styleId ( ) const

◆ text()

std::string openword::Paragraph::text ( ) const

The documentation for this class was generated from the following file: