PDFsharp & MigraDoc Foundation

PDFsharp - A .NET library for processing PDF & MigraDoc Foundation - Creating documents on the fly
It is currently Sat Apr 27, 2024 6:31 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: Wed Oct 11, 2023 5:10 pm 
Offline

Joined: Mon Oct 09, 2023 12:42 pm
Posts: 10
Does anyone have any ideas for hatching the background of a cell?


Top
 Profile  
Reply with quote  
PostPosted: Thu Oct 12, 2023 6:16 am 
Offline

Joined: Mon Oct 09, 2023 12:42 pm
Posts: 10
I surfed for hours to no avail. I have the impression that this is impossible with MigraDoc.
:( No pattern creation solution exists.


Top
 Profile  
Reply with quote  
PostPosted: Thu Oct 12, 2023 7:40 am 
Offline
PDFsharp Expert
User avatar

Joined: Sat Mar 14, 2015 10:15 am
Posts: 916
Location: CCAA
MigraDoc was designed with the capabilities of Word 97 or so in mind.
Is there hatching with Word?
I think there is no built-in hatching with MigraDoc.

I think it is possible to add the hatching using PDFsharp code when rendering the pages one by one and accessing the RenderInfo structures to get information about the cells.
Each document object (e.g. each cell) has a "Tag" property that can be used to store an object with private information. This can be used to set the hatching information for each cell.

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


Top
 Profile  
Reply with quote  
PostPosted: Thu Oct 12, 2023 9:24 am 
Offline

Joined: Mon Oct 09, 2023 12:42 pm
Posts: 10
Thanks Thomas. I'm going to keep on trying to find a solution


Top
 Profile  
Reply with quote  
PostPosted: Thu Oct 12, 2023 3:06 pm 
Offline

Joined: Mon Oct 09, 2023 12:42 pm
Posts: 10
I'll found a simple solution :

My image is a .png with transparent !

Code:
 row = table.AddRow();
 cell = row.Cells[0];
 var p = cell.AddParagraph("");

 var imageAdded = p.AddImage(image);
 imageAdded.Width = table.Columns[0].Width;
 imageAdded.FillFormat.Color = Colors.LightSalmon;

var pp = cell.AddParagraph("Great !");
pp.Format.SpaceBefore = "-0.5cm";
pp.Format.Shading.Color = Colors.Transparent;


Attachments:
Capture d'écran 2023-10-12 170512.png
Capture d'écran 2023-10-12 170512.png [ 122.6 KiB | Viewed 3700 times ]
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: No registered users and 390 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