C# Class TemplNET.TemplGraphic

Used to store/load images and generate (scaled) pictures.
Show file Open project: CPonty/templ-dot-net Class Usage Examples

Public Properties

Property Type Description
Alignment Alignment?
Description string
Scalar double
Stream MemoryStream

Protected Properties

Property Type Description
Image Novacode.Image

Public Methods

Method Description
Load ( DocX doc ) : TemplGraphic

Load image into document. Required before producing a Picture for the document.

Picture ( ) : Picture

Generate a Picture instance, which can be inserted into a Document

Picture ( double scalar ) : Picture

Generate a Picture instance, which can be inserted into a Document

Picture ( uint width ) : Picture

Generate a Picture instance, which can be inserted into a Document

TemplGraphic ( Stream data, Alignment align = null, double scalar = 1.0, string description = "" ) : System

New graphic from data stream

TemplGraphic ( byte data, Alignment align = null, double scalar = 1.0, string description = "" ) : System

New graphic from file data

TemplGraphic ( string file, Alignment align = null, double scalar = 1.0, string description = "" ) : System

New graphic from filename

Method Details

Load() public method

Load image into document. Required before producing a Picture for the document.
public Load ( DocX doc ) : TemplGraphic
doc DocX
return TemplGraphic

Picture() public method

Generate a Picture instance, which can be inserted into a Document
public Picture ( ) : Picture
return Picture

Picture() public method

Generate a Picture instance, which can be inserted into a Document
public Picture ( double scalar ) : Picture
scalar double The scaling factor (0.5 is 50%)
return Picture

Picture() public method

Generate a Picture instance, which can be inserted into a Document
public Picture ( uint width ) : Picture
width uint The width in pixels
return Picture

TemplGraphic() public method

New graphic from data stream
public TemplGraphic ( Stream data, Alignment align = null, double scalar = 1.0, string description = "" ) : System
data Stream
align Alignment
scalar double
description string
return System

TemplGraphic() public method

New graphic from file data
public TemplGraphic ( byte data, Alignment align = null, double scalar = 1.0, string description = "" ) : System
data byte
align Alignment
scalar double
description string
return System

TemplGraphic() public method

New graphic from filename
public TemplGraphic ( string file, Alignment align = null, double scalar = 1.0, string description = "" ) : System
file string
align Alignment
scalar double
description string
return System

Property Details

Alignment public property

Alignment when inserting into the document (e.g. Left, Right, Centre). No change in alignment if null
public Alignment? Alignment
return Alignment?

Description public property

String description of the image. Has no automatic function; useful for storing caption text in the model.
public string Description
return string

Image protected property

Underlying DocX image instance Not populated until document build time, as it requires a reference to a DocX document
protected Image,Novacode Image
return Novacode.Image

Scalar public property

Resizing factor when inserting into the document. Maintains aspect ratio
public double Scalar
return double

Stream public property

Image data as memory stream
public MemoryStream Stream
return MemoryStream