PDFsharp & MigraDoc Foundation
https://forum.pdfsharp.net/

Formatted Text in Header
https://forum.pdfsharp.net/viewtopic.php?f=2&t=3038
Page 1 of 1

Author:  mgbig [ Mon Jan 26, 2015 4:40 pm ]
Post subject:  Formatted Text in Header

Hello

I have this code in VB.NET to format a header for every page:
Code:
Dim header As HeaderFooter = section.Headers.Primary
header.AddParagraph("My Name")
header.AddParagraph("My Streea")
header.AddParagraph("1234 My Town")
header.AddParagraph("Phone: 1234-5787")
header.AddParagraph("my@email.com")


I want to have "My Name" in bold and "my@email" in a smaller font. Is this possible?
mgbig

Author:  Thomas Hoevel [ Mon Jan 26, 2015 4:50 pm ]
Post subject:  Re: Formatted Text in Header

Hi!

Use AddFormattedText() to mix several formats in one paragraph.
Or use different styles for the paragraphs to modify the whole paragraph.

The key is
Code:
Dim para as Paragraph = header.AddParagraph("My Name")
para.Style = [...]


C# sample that uses styles and AddFormattedText():
http://www.pdfsharp.net/wiki/HelloMigraDoc-sample.ashx

Author:  mgbig [ Mon Jan 26, 2015 7:35 pm ]
Post subject:  Re: Formatted Text in Header

I had seen the sample, but I got it running with this extra Hint.

Thank you so far. I will be back soon :wink:

Page 1 of 1 All times are UTC
Powered by phpBB® Forum Software © phpBB Group
https://www.phpbb.com/