PDFsharp & MigraDoc Foundation

PDFsharp - A .NET library for processing PDF & MigraDoc Foundation - Creating documents on the fly
It is currently Sun Sep 08, 2024 3:24 am

All times are UTC


Forum rules


Please read this before posting on this forum: Forum Rules



Post new topic Reply to topic  [ 2 posts ] 
Author Message
 Post subject: MigraDoc to VB.Net
PostPosted: Wed May 01, 2013 3:02 pm 
Offline

Joined: Wed May 01, 2013 2:41 pm
Posts: 1
I have been using MigraDoc with our C# applications with great success, however we have a VB.Net that I have rarely had to work with but a report is needed from it I thought it would be pretty simple to just use MigraDoc there.

I am not nearly as good with VB.Net but I did get the code converted from one of our C# apps but had no luck actually getting it to work.

I then tried going with the invoice example and ran into the same issues.

Has anyone had success doing this that would help me.
The following code gives me the error of Style is not Defined

Code:
    Public Sub DefineStyles()
        'Get the predefined style Normal.
        Dim style As Style = Me.document.Styles("Normal")
        ' Because all styles are derived from Normal, the next line changes the
        ' font of the whole document. Or, more exactly, it changes the font of
        ' all styles and paragraphs that do not redefine the font.
        style.Font.Name = "Verdana"

        style = Me.document.Styles(StyleNames.Header)
        style.ParagraphFormat.AddTabStop("16cm", TabAlignment.Right)

        style = Me.document.Styles(StyleNames.Footer)
        style.ParagraphFormat.AddTabStop("8cm", TabAlignment.Center)

        ' Create a new style called Table based on style Normal
        style = Me.document.Styles.AddStyle("Table", "Normal")
        style.Font.Name = "Verdana"
        style.Font.Name = "Times New Roman"
        style.Font.Size = 9

        ' Create a new style called Reference based on style Normal
        style = Me.document.Styles.AddStyle("Reference", "Normal")
        style.ParagraphFormat.SpaceBefore = "5mm"
        style.ParagraphFormat.SpaceAfter = "5mm"
        style.ParagraphFormat.TabStops.AddTabStop("16cm", TabAlignment.Right)
    End Sub


Top
 Profile  
Reply with quote  
 Post subject: Re: MigraDoc to VB.Net
PostPosted: Thu May 02, 2013 9:13 am 
Offline
PDFsharp Guru
User avatar

Joined: Mon Oct 16, 2006 8:16 am
Posts: 3109
Location: Cologne, Germany
Probably the Imports statement (or even the reference) is missing for that class.
Try "Imports MigraDoc.DocumentObjectModel" or use "MigraDoc.DocumentObjectModel.Style".

_________________
Regards
Thomas Hoevel
PDFsharp Team


Top
 Profile  
Reply with quote  
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 2 posts ] 

All times are UTC


Who is online

Users browsing this forum: No registered users and 45 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
Privacy Policy, Data Protection Declaration, Impressum
Powered by phpBB® Forum Software © phpBB Group