PDFsharp & MigraDoc Foundation

PDFsharp - A .NET library for processing PDF & MigraDoc Foundation - Creating documents on the fly
It is currently Thu Mar 28, 2024 5:52 pm

All times are UTC


Forum rules


Please read this before posting on this forum: Forum Rules



Post new topic Reply to topic  [ 3 posts ] 
Author Message
PostPosted: Thu Aug 24, 2017 2:46 pm 
Offline

Joined: Thu Aug 24, 2017 2:42 pm
Posts: 2
Hi,

I'm new at MigraDoc and have the following Problem.

I have a Migradoc
Code:
var table
for my PDF document. There are multiple Rows with a person ID, name, firstname and so on. Now I would like to compare the table id with a string, like:

Code:
if (table.Rows[i][10].ToString() == Person.ID && table.Rows[i][10].ToString() != "")
{
    //do something
}

Unfortunately, he does not go into the query because I think
Code:
table.Rows[i][10].ToString()
is not the correct call. Is there a way to call the value of the cell?

I'm using MigraDoc with WPFBuild in Version 1.32


Top
 Profile  
Reply with quote  
PostPosted: Thu Aug 24, 2017 3:52 pm 
Offline
PDFsharp Guru
User avatar

Joined: Mon Oct 16, 2006 8:16 am
Posts: 3095
Location: Cologne, Germany
Hi!
Hadda wrote:
Is there a way to call the value of the cell?
Yes, but there is no simple way. A cell can contain many document elements. In the most simple case you have a paragraph with a text element.

Your code fills the cell so your code should know what's in it. Maybe keep an array where you can lookup the ID for row 5.

Simple workaround: assign the text you put into that cell to the "Tag" member of the cell and use that for comparison. No extra array needed.

_________________
Regards
Thomas Hoevel
PDFsharp Team


Top
 Profile  
Reply with quote  
PostPosted: Fri Aug 25, 2017 1:12 pm 
Offline

Joined: Thu Aug 24, 2017 2:42 pm
Posts: 2
Thomas Hoevel wrote:
Hi!
Hadda wrote:
Is there a way to call the value of the cell?
Yes, but there is no simple way. A cell can contain many document elements. In the most simple case you have a paragraph with a text element.

Your code fills the cell so your code should know what's in it. Maybe keep an array where you can lookup the ID for row 5.

Simple workaround: assign the text you put into that cell to the "Tag" member of the cell and use that for comparison. No extra array needed.


Thank you. That worked for me :)


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

All times are UTC


Who is online

Users browsing this forum: No registered users and 128 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