PDFsharp & MigraDoc Foundation http://forum.pdfsharp.com/ |
|
How to get text to combine bold AND underline? http://forum.pdfsharp.com/viewtopic.php?f=2&t=4656 |
Page 1 of 1 |
Author: | AlainM [ Tue Aug 20, 2024 3:04 pm ] |
Post subject: | How to get text to combine bold AND underline? |
Hi all, Currently using PDFSarp 1.50 (and would like to stick to it...) Is there a way to combine string format values when creating a PDF text? My application allows to display texts that can be bold, italic, underlined and strikethrough all at the same time. But the current XFontStyle enum seems to only allow bold and italic at the same time. Is there a way to create a text which would be, for example, bold and underlined at the same time? Thanks in advance. |
Author: | TH-Soft [ Wed Aug 21, 2024 5:42 am ] |
Post subject: | Re: How to get text to combine bold AND underline? |
Hi! AlainM wrote: But the current XFontStyle enum seems to only allow bold and italic at the same time. No, that enum uses the magic keyword "[Flags]" and you can use the magic operator "|" to combine values to get what you want.Two lines from the current PDFsharp version: Code: var fontAnsi = new XFont("Arial", 15, XFontStyleEx.Regular | XFontStyleEx.Underline, XPdfFontOptions.WinAnsiDefault); var fontAnsiBold = new XFont("Arial", 15, XFontStyleEx.Bold | XFontStyleEx.Underline, XPdfFontOptions.WinAnsiDefault); Note that "XFontStyle" was renamed to "XFontStyleEx". With PDFsharp 1.50, you miss out all the bug fixes from the last 5 and a half years. |
Page 1 of 1 | All times are UTC |
Powered by phpBB® Forum Software © phpBB Group https://www.phpbb.com/ |