本文整理汇总了C#中iTextSharp.text.rtf.document.RtfDocument类的典型用法代码示例。如果您正苦于以下问题:C# RtfDocument类的具体用法?C# RtfDocument怎么用?C# RtfDocument使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
RtfDocument类属于iTextSharp.text.rtf.document命名空间,在下文中一共展示了RtfDocument类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: RtfParagraph
/**
* Constructs a RtfParagraph belonging to a RtfDocument based on a Paragraph.
*
* @param doc The RtfDocument this RtfParagraph belongs to
* @param paragraph The Paragraph that this RtfParagraph is based on
*/
public RtfParagraph(RtfDocument doc, Paragraph paragraph) : base(doc) {
ST.RtfFont baseFont = null;
if (paragraph.Font is ST.RtfParagraphStyle) {
this.paragraphStyle = this.document.GetDocumentHeader().GetRtfParagraphStyle(((ST.RtfParagraphStyle) paragraph.Font).GetStyleName());
baseFont = this.paragraphStyle;
} else {
baseFont = new ST.RtfFont(this.document, paragraph.Font);
this.paragraphStyle = new ST.RtfParagraphStyle(this.document, this.document.GetDocumentHeader().GetRtfParagraphStyle("Normal"));
this.paragraphStyle.SetAlignment(paragraph.Alignment);
this.paragraphStyle.SetFirstLineIndent((int) (paragraph.FirstLineIndent * RtfElement.TWIPS_FACTOR));
this.paragraphStyle.SetIndentLeft((int) (paragraph.IndentationLeft * RtfElement.TWIPS_FACTOR));
this.paragraphStyle.SetIndentRight((int) (paragraph.IndentationRight * RtfElement.TWIPS_FACTOR));
this.paragraphStyle.SetSpacingBefore((int) (paragraph.SpacingBefore * RtfElement.TWIPS_FACTOR));
this.paragraphStyle.SetSpacingAfter((int) (paragraph.SpacingAfter * RtfElement.TWIPS_FACTOR));
if (paragraph.HasLeading()) {
this.paragraphStyle.SetLineLeading((int) (paragraph.Leading * RtfElement.TWIPS_FACTOR));
}
this.paragraphStyle.SetKeepTogether(paragraph.KeepTogether);
}
for (int i = 0; i < paragraph.Count; i++) {
IElement chunk = (IElement) paragraph[i];
if (chunk is Chunk) {
((Chunk) chunk).Font = baseFont.Difference(((Chunk) chunk).Font);
} else if (chunk is RtfImage) {
((RtfImage) chunks[i]).SetAlignment(this.paragraphStyle.GetAlignment());
}
try {
IRtfBasicElement[] rtfElements = doc.GetMapper().MapElement(chunk);
for(int j = 0; j < rtfElements.Length; j++) {
chunks.Add(rtfElements[j]);
}
} catch (DocumentException) {
}
}
}
示例2: SetRtfDocument
/**
* Sets the RtfDocument this RtfElement belongs to
*
* @param doc The RtfDocument to use
*/
public void SetRtfDocument(RtfDocument doc)
{
this.document = doc;
if (this.document != null) {
for (int i = 0; i < this.content.Length; i++) {
try {
if (this.content[i] is Element) {
this.content[i] = this.document.GetMapper().MapElement((IElement) this.content[i])[0];
((IRtfBasicElement) this.content[i]).SetInHeader(true);
} else if (this.content[i] is IRtfBasicElement){
((IRtfBasicElement) this.content[i]).SetRtfDocument(this.document);
((IRtfBasicElement) this.content[i]).SetInHeader(true);
}
} catch (DocumentException) {
}
}
}
}
示例3: RtfWriter2
/**
* Constructs a new RtfWriter that listens to the specified Document and
* writes its output to the Stream.
*
* @param doc The Document that this RtfWriter listens to
* @param os The Stream to write to
*/
protected RtfWriter2(Document doc, Stream os) : base(doc, os) {
doc.AddDocListener(this);
rtfDoc = new RtfDocument();
}
示例4: RtfPageSetting
/**
* Constructs a new RtfPageSetting object belonging to a RtfDocument.
*
* @param doc The RtfDocument this RtfPageSetting belongs to
*/
public RtfPageSetting(RtfDocument doc) : base(doc) {
}
示例5: RtfFontList
/**
* Creates a RtfFontList
*
* @param doc The RtfDocument this RtfFontList belongs to
*/
public RtfFontList(RtfDocument doc)
: base(doc)
{
fontList.Add(new RtfFont(document, 0));
}
示例6: RtfListLevel
public RtfListLevel(RtfDocument doc, RtfList parent) : base(doc)
{
this.parent = parent;
templateID = document.GetRandomInt();
SetFontNumber( new RtfFont(document, new Font(Font.TIMES_ROMAN, 10, Font.NORMAL, new Color(0, 0, 0))));
SetBulletFont(new Font(Font.SYMBOL, 10, Font.NORMAL, new Color(0, 0, 0)));
}
示例7: SetRtfDocument
/**
* Sets the RtfDocument this RtfPhrase belongs to. Also sets the RtfDocument for all child
* elements.
*
* @param doc The RtfDocument to use
*/
public override void SetRtfDocument(RtfDocument doc) {
base.SetRtfDocument(doc);
for (int i = 0; i < this.chunks.Count; i++) {
((IRtfBasicElement) this.chunks[i]).SetRtfDocument(this.document);
}
}
示例8: RtfPhrase
/**
* A basically empty constructor that is used by the RtfParagraph.
*
* @param doc The RtfDocument this RtfPhrase belongs to.
*/
protected internal RtfPhrase(RtfDocument doc) : base(doc) {
}
示例9: RtfCell
/**
* Constructs a RtfCell based on a Cell.
*
* @param doc The RtfDocument this RtfCell belongs to
* @param row The RtfRow this RtfCell lies in
* @param cell The PdfPCell to base this RtfCell on
* @since 2.1.3
*/
protected internal RtfCell(RtfDocument doc, RtfRow row, PdfPCell cell)
{
this.document = doc;
this.parentRow = row;
ImportCell(cell);
}
示例10: SetRtfDocument
/**
* Sets the RtfDocument this RtfColor belongs to
*
* @param doc The RtfDocument to use
*/
public override void SetRtfDocument(RtfDocument doc) {
base.SetRtfDocument(doc);
if (document != null) {
this.colorNumber = document.GetDocumentHeader().GetColorNumber(this);
}
}
示例11: RtfColor
/**
* Constructs a RtfColor based on the red/green/blue values
*
* @param doc The RtfDocument this RtfColor belongs to
* @param red The red value to use
* @param green The green value to use
* @param blue The blue value to use
*/
public RtfColor(RtfDocument doc, int red, int green, int blue) : base(doc) {
this.red = red;
this.blue = blue;
this.green = green;
if (this.document != null) {
this.colorNumber = this.document.GetDocumentHeader().GetColorNumber(this);
}
}
示例12: RtfPictureList
public RtfPictureList(RtfDocument doc) : base(doc) {
}
示例13: RtfListItem
/**
* Constructs a RtfListItem for a ListItem belonging to a RtfDocument.
*
* @param doc The RtfDocument this RtfListItem belongs to.
* @param listItem The ListItem this RtfListItem is based on.
*/
public RtfListItem(RtfDocument doc, ListItem listItem)
: base(doc, listItem)
{
}
示例14: RtfChunk
/**
* Constructs a RtfChunk based on the content of a Chunk
*
* @param doc The RtfDocument that this Chunk belongs to
* @param chunk The Chunk that this RtfChunk is based on
*/
public RtfChunk(RtfDocument doc, Chunk chunk)
: base(doc)
{
if (chunk == null) {
return;
}
if (chunk.Attributes != null && chunk.Attributes[Chunk.SUBSUPSCRIPT] != null) {
this.superSubScript = (float)chunk.Attributes[Chunk.SUBSUPSCRIPT];
}
if (chunk.Attributes != null && chunk.Attributes[Chunk.BACKGROUND] != null) {
this.background = new RtfColor(this.document, (Color) ((Object[]) chunk.Attributes[Chunk.BACKGROUND])[0]);
}
font = new ST.RtfFont(doc, chunk.Font);
content = chunk.Content;
}
示例15: SetRtfDocument
/**
* Sets the RtfDocument this RtfChunk belongs to.
*
* @param doc The RtfDocument to use
*/
public override void SetRtfDocument(RtfDocument doc)
{
base.SetRtfDocument(doc);
this.font.SetRtfDocument(this.document);
}