C# Class TemplNET.TemplDoc

Represents an instance of a document
ファイルを表示 Open project: CPonty/templ-dot-net Class Usage Examples

Public Properties

Property Type Description
Docx Novacode.DocX
Stream System.IO.MemoryStream

Private Properties

Property Type Description

Public Methods

Method Description
CellClear ( Cell cell, bool deleteAllParagraphs = false ) : void

Clear text and images from all paragraphs in cell. Optional: Delete all paragraph objects. Keep in mind, cells with zero paragraphs are considered malformed by Word! Also keep in mind, you will lose formatting info (e.g. font). Special cases of content other than text or images may not be removed; If this becomes a problem, we can develop it.

CellCopyContents ( Cell srcCell, Cell dstCell ) : void

Copy (text) contents of srcCell into dstCell. Clears text of dstCell plus all but first paragraph instance before copying.

CellCopyProperties ( Cell fromCell, Cell toCell ) : void
Commit ( ) : TemplDoc

Save to internal memory. Initialising a *new* stream is important due to the internal structure of DocX's load/save.

Copy ( ) : TemplDoc

Clone

Paragraphs ( DocX doc ) : IEnumerable

Retrieves all paragraph references from the document body, header, footer, and table content.

SaveAs ( string fileName ) : void

Save to disk. Supplied file name is sanitized and converted to '.zip'

TemplDoc ( DocX document ) : System.Collections.Generic

Start with passed-in doc

TemplDoc ( Stream stream ) : System.Collections.Generic

New document from data stream

TemplDoc ( byte data ) : System.Collections.Generic

New document from file data

TemplDoc ( string filename ) : System.Collections.Generic

New document from filename

Method Details

CellClear() public static method

Clear text and images from all paragraphs in cell. Optional: Delete all paragraph objects. Keep in mind, cells with zero paragraphs are considered malformed by Word! Also keep in mind, you will lose formatting info (e.g. font). Special cases of content other than text or images may not be removed; If this becomes a problem, we can develop it.
public static CellClear ( Cell cell, bool deleteAllParagraphs = false ) : void
cell Novacode.Cell
deleteAllParagraphs bool
return void

CellCopyContents() public static method

Copy (text) contents of srcCell into dstCell. Clears text of dstCell plus all but first paragraph instance before copying.
public static CellCopyContents ( Cell srcCell, Cell dstCell ) : void
srcCell Novacode.Cell
dstCell Novacode.Cell
return void

CellCopyProperties() public static method

public static CellCopyProperties ( Cell fromCell, Cell toCell ) : void
fromCell Novacode.Cell
toCell Novacode.Cell
return void

Commit() public method

Save to internal memory. Initialising a *new* stream is important due to the internal structure of DocX's load/save.
public Commit ( ) : TemplDoc
return TemplDoc

Copy() public method

Clone
public Copy ( ) : TemplDoc
return TemplDoc

Paragraphs() public static method

Retrieves all paragraph references from the document body, header, footer, and table content.
public static Paragraphs ( DocX doc ) : IEnumerable
doc Novacode.DocX
return IEnumerable

SaveAs() public method

Save to disk. Supplied file name is sanitized and converted to '.zip'
public SaveAs ( string fileName ) : void
fileName string
return void

TemplDoc() public method

Start with passed-in doc
public TemplDoc ( DocX document ) : System.Collections.Generic
document Novacode.DocX
return System.Collections.Generic

TemplDoc() public method

New document from data stream
public TemplDoc ( Stream stream ) : System.Collections.Generic
stream System.IO.Stream
return System.Collections.Generic

TemplDoc() public method

New document from file data
public TemplDoc ( byte data ) : System.Collections.Generic
data byte
return System.Collections.Generic

TemplDoc() public method

New document from filename
public TemplDoc ( string filename ) : System.Collections.Generic
filename string
return System.Collections.Generic

Property Details

Docx public_oe property

Underlying DocX document instance
public DocX,Novacode Docx
return Novacode.DocX

Stream public_oe property

Document as memory stream. Automatically updates from the underlying DocX document on Commit(), SaveAs(), Copy()
public MemoryStream,System.IO Stream
return System.IO.MemoryStream