This topic is locked

Convert DAL dynamic to Sting without Losing formatting

11/7/2016 3:15:52 PM
ASPRunner.NET General questions
H
hgoodric author

I am using ITextSharp 5.10 pdf writer in conjunction with a buttom that I placed to show up in the left hand side of each row of a master list. The idea here is that quote document information (Master) and quote line items(Details) are pushed into a MySQL database by another system. The Master-Detail tables allow the end user to have enough control over what the resulting pdf looks like. They have control over the details fields and can add or change what they need to make a good looking Quote document.
The C# button code grabs all the data from the current master record and its detail records and creates a pdf document using the ItextSharp DLL for C#.
One of the detail fields is a TEXT() field in MySQL, which allows some formatting line CR/LF via a textarea input in the detail row. I use the custom query method to get the data:
....stuff setting up the ITextSharp, etc....
string sql1 = "SELECT quotdesID, rowID, rowNum, Item, PartorDesc, qtyquoted, unitprice, extprice, configtxt, showline, Author, setParent, ConceptNumber, ParentDesignID, QtyGroupID, designID, SumQtyGroups, Spacer FROM ifrdata.quotedocbodyitems where quotdesID= \"" + (Rowdata["quotedesignid"]).ToString() + "\" and showline=true order by rowNum;";

XVar rs2 = tDAL.CustomQuery(sql1);

while(IdataSum = CommonFunctions.db_fetch_array(rs2))

{

.......stuff
pdf writer code:

Chunk Desc_Chunk = new Chunk(Idata["PartorDesc"].ToString());

Desc_Chunk.Font = _smallFont;

PdfPCell DescCell = new PdfPCell(new Phrase(Desc_Chunk));

DescCell.Border=0;

Itemtable.AddCell(DescCell);
.....stuff

}
PartorDesc is the TEXT() field.
The problem is that when I grab the Idata["PartorDesc"] data, the type is initially dynamic, but if I use the method Idata["PartorDesc"].ToString() it flattens the newlines out of it. The Chunk class of Itextsharp does not accept dynamic types.
Any ideas?

H
hgoodric author 11/15/2016



I am using ITextSharp 5.10 pdf writer in conjunction with a buttom that I placed to show up in the left hand side of each row of a master list. The idea here is that quote document information (Master) and quote line items(Details) are pushed into a MySQL database by another system. The Master-Detail tables allow the end user to have enough control over what the resulting pdf looks like. They have control over the details fields and can add or change what they need to make a good looking Quote document.
The C# button code grabs all the data from the current master record and its detail records and creates a pdf document using the ItextSharp DLL for C#.
One of the detail fields is a TEXT() field in MySQL, which allows some formatting line CR/LF via a textarea input in the detail row. I use the custom query method to get the data:
....stuff setting up the ITextSharp, etc....
string sql1 = "SELECT quotdesID, rowID, rowNum, Item, PartorDesc, qtyquoted, unitprice, extprice, configtxt, showline, Author, setParent, ConceptNumber, ParentDesignID, QtyGroupID, designID, SumQtyGroups, Spacer FROM ifrdata.quotedocbodyitems where quotdesID= \"" + (Rowdata["quotedesignid"]).ToString() + "\" and showline=true order by rowNum;";

XVar rs2 = tDAL.CustomQuery(sql1);

while(Idata = CommonFunctions.db_fetch_array(rs2))

{

.......stuff
pdf writer code:

Chunk Desc_Chunk = new Chunk(Idata["PartorDesc"].ToString());

Desc_Chunk.Font = _smallFont;

PdfPCell DescCell = new PdfPCell(new Phrase(Desc_Chunk));

DescCell.Border=0;

Itemtable.AddCell(DescCell);
.....stuff

}
PartorDesc is the TEXT() field.
The problem is that when I grab the Idata["PartorDesc"] data, the type is initially dynamic, but if I use the method Idata["PartorDesc"].ToString() it flattens the newlines out of it. The Chunk class of Itextsharp does not accept dynamic types.
Any ideas?

H
hgoodric author 11/15/2016

Any Ideas? Do I need to give more information?
Thnx!!

Harold G