PDFsharp - moved to http://forum.pdfsharp.net/ Forum Index PDFsharp - moved to http://forum.pdfsharp.net/
Please visit the new PDFsharp forum at http://forum.pdfsharp.net/
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

Automatic expanding TextFrame

 
This forum is locked: you cannot post, reply to, or edit topics.   This topic is locked: you cannot edit posts or make replies.    PDFsharp - moved to http://forum.pdfsharp.net/ Forum Index -> Support - moved to http://forum.pdfsharp.net/
View previous topic :: View next topic  
Author Message
Orestone



Joined: 24 Oct 2008
Posts: 7
Location: Brisbane, Australia

PostPosted: Thu Mar 19, 2009 7:24 am    Post subject: Automatic expanding TextFrame Reply with quote

Is it possible to make a TextFrame increase its Height to contain its content?

for example the following code snippet creates a TextFrame with a border but the borders only 'contain' lines 1 to 6. Lines 7 to 9 fall outside the borders.

Code:
        private void AddLeftBox(Section section)
        {
            var frame = section.AddTextFrame();
            frame.Width = new Unit(80.0, UnitType.Millimeter);
            frame.LineFormat.Width = Unit.FromPoint(0.5);
            for (int i = 1; i < 10; i++)
                frame.AddParagraph("Line " + i);
        }


Failing an automatic way of doing this is there a way to measure the contents of the TextFrame after they have been added and then retrospectively set the TextFrame.Height property[/code]
Back to top
View user's profile Send private message
Thomas Hoevel



Joined: 16 Oct 2006
Posts: 387
Location: Cologne, Germany

PostPosted: Thu Mar 19, 2009 7:52 am    Post subject: Reply with quote

Workaround: add a table to the textframe and set the border of the table.
_________________
Regards
Thomas Hoevel
PDFsharp Team
Back to top
View user's profile Send private message Visit poster's website
Orestone



Joined: 24 Oct 2008
Posts: 7
Location: Brisbane, Australia

PostPosted: Thu Mar 19, 2009 7:46 pm    Post subject: Reply with quote

Thanks Thomas.

I was hoping not to clutter the structure of the document like that but I shall take your suggestion on board.

Is this unimplemented functionality/feature in MigraDoc or is there a reason why the TextFrame behaves that way?

Cheers
Simon
Back to top
View user's profile Send private message
Orestone



Joined: 24 Oct 2008
Posts: 7
Location: Brisbane, Australia

PostPosted: Fri Mar 20, 2009 1:40 am    Post subject: Reply with quote

Just to add closure for others' benefit - this is an acceptable workaround for my situation Very Happy

Code:
private void AddLeftBox(Section section)
{
    var frame = section.AddTextFrame();

    Table table = frame.AddTable();
    table.Borders.Width = 0.5;
    table.LeftPadding = 0;

    var column = table.AddColumn();
    column.Width = Unit.FromMillimeter(80);

    Row row = table.AddRow();

    for (int i = 1; i < 10; i++)
        row[0].AddParagraph("Line " + i);
}


The line
Code:
table.LeftPadding = 0;
ensures that the table is aligned with other paragraph borders in my document. You may not need this in other applications (as appropriate).

Thanks again
Back to top
View user's profile Send private message
Display posts from previous:   
This forum is locked: you cannot post, reply to, or edit topics.   This topic is locked: you cannot edit posts or make replies.    PDFsharp - moved to http://forum.pdfsharp.net/ Forum Index -> Support - moved to http://forum.pdfsharp.net/ All times are GMT
Page 1 of 1

 
Jump to:  
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 vote in polls in this forum


Powered by phpBB © phpBB Group. Hosted by phpBB.BizHat.com


Start Your Own YouTube Clone

Free Web Hosting | Free Forum Hosting | FlashWebHost.com | Image Hosting | Photo Gallery | FreeMarriage.com

Powered by PhpBBweb.com, setup your forum now!
For Support, visit Forums.BizHat.com