Click here to Skip to main content
15,891,184 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Chunk c = new Chunk("TITLE", FontFactory.GetFont("Times New Roman", 2));
                            Paragraph p = new Paragraph(); // this line is error
                            p.Alignment = Element.ALIGN_CENTER;
                            p.IndentationLeft = 2;

cb.SetFontAndSize(BaseFont.CreateFont(), 10);
ct.SetSimpleColumn(new iTextSharp.text.Rectangle(50, 20, 40, 80));
ct.AddElement( new Paragraph(String.Format("TITLE DEFINE")));  //this line error.
                            ct.Go();

rows running in windows form do not work in wpf
why is that?

This error is:

Paragpraph is an ambiguous reference between System.Windows.Documents.Paragraph and iTextSharp.text.Paragraph

What I have tried:

Chunk c = new Chunk("TITLE", FontFactory.GetFont("Times New Roman", 2));
                            Paragraph p = new Paragraph(); // this line is error
                            p.Alignment = Element.ALIGN_CENTER;
                            p.IndentationLeft = 2;

cb.SetFontAndSize(BaseFont.CreateFont(), 10);
ct.SetSimpleColumn(new iTextSharp.text.Rectangle(50, 20, 40, 80));
ct.AddElement( new Paragraph(String.Format("TITLE DEFINE")));  //this line error.
                            ct.Go();
Posted
Updated 20-Aug-19 8:21am
v4
Comments
Maciej Los 21-Aug-19 2:24am    
You can't totally change your question while there's at least one answer!
I'm rolling back to original one.

1 solution

Pretty self-explanatory there; you are calling a class/method/property which has 2 possible definitions:
1. System.Windows.Documents.Paragraph
2. iTextSharp.text.Paragraph

So the compiler has no clue which one to choose.

Options:
1. Delete the reference (using) from this page of code if you don't need both
2. Define your Paragraph by its fully-qualified namespace.class.property
C#
iTextSharp.text.Paragraph p = new iTextSharp.text.Paragraph();
/* ---- OR --- */
System.Windows.Documents.Paragraph p = new System.Windows.Documents.Paragraph();
 
Share this answer
 
Comments
MadMyche 19-Aug-19 17:27pm    
You could try using that full definition there as well. I don't use that plugin so I do not know which references you need or what methods to call

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900