PDFsharp & MigraDoc Foundation

PDFsharp - A .NET library for processing PDF & MigraDoc Foundation - Creating documents on the fly
It is currently Sat Apr 27, 2024 9:26 pm

All times are UTC


Forum rules


Please read this before posting on this forum: Forum Rules



Post new topic Reply to topic  [ 5 posts ] 
Author Message
PostPosted: Fri Jan 03, 2014 6:29 am 
Offline

Joined: Fri Jan 03, 2014 6:25 am
Posts: 5
Hi Guys,

I've posted a question here http://stackoverflow.com/questions/20896175/align-two-paragraphs-in-one-line

Can anyone help me with my problem?


Top
 Profile  
Reply with quote  
PostPosted: Fri Jan 03, 2014 3:18 pm 
Offline
PDFsharp Expert
User avatar

Joined: Wed Dec 09, 2009 8:59 am
Posts: 340
Answer posted on SO.

_________________
Öhmesh Volta ("() => true")
PDFsharp Team Holiday Substitute


Top
 Profile  
Reply with quote  
PostPosted: Tue Jan 21, 2014 3:24 am 
Offline

Joined: Fri Jan 03, 2014 6:25 am
Posts: 5
I used two textfarmes adjacent to the first one. I was able to align them using DistanceLeft and MarginTop properties.


Top
 Profile  
Reply with quote  
PostPosted: Sat Oct 14, 2023 9:39 am 
Offline

Joined: Mon Aug 07, 2023 9:07 pm
Posts: 7
SO answer is wrong. Paragraphs can added to same row using negative SpaceBefore values:

Code:
            var document = new Document { };
            var section = document.AddSection();
            section.AddParagraph("paragraph1" + Environment.NewLine + "second line");
            var par2 = section.AddParagraph("paragraph2");
            par2.Format.LeftIndent = "4cm";
            par2.Format.SpaceBefore = "-0.8cm";


Correct answer added.


Top
 Profile  
Reply with quote  
PostPosted: Sun Oct 15, 2023 8:36 am 
Offline
PDFsharp Expert
User avatar

Joined: Sat Mar 14, 2015 10:15 am
Posts: 916
Location: CCAA
OK, proof of concept works. But it quickly gets complicated when you have variable text in both paragraphs. You must also set `RightIndent` for first paragraph, the value for `SpaceBefore` must be determined based on the contents of the first paragraph, you must ensure there is no page break between the two paragraphs.

Answer on SO is no longer wrong.

_________________
Best regards
Thomas
(Freelance Software Developer with several years of MigraDoc/PDFsharp experience)


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

All times are UTC


Who is online

Users browsing this forum: Google [Bot] and 379 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