TECHNOLOGIES
FORUMS
JOBS
BOOKS
EVENTS
INTERVIEWS
Live
MORE
LEARN
Training
CAREER
MEMBERS
VIDEOS
NEWS
BLOGS
Sign Up
Login
No unread comment.
View All Comments
No unread message.
View All Messages
No unread notification.
View All Notifications
Answers
Post
An Article
A Blog
A News
A Video
An EBook
An Interview Question
Ask Question
Forums
Monthly Leaders
Forum guidelines
Goran Bibic
480
2.9k
200.7k
Column type ITEXTSHARP C#
May 2 2018 12:09 PM
I have problem with output result...
Column have value 16.2.2018 00:00:00
I need value 16.2.2018
Sql column type is DATE
Need help
private
void
button2_Click(object sender, EventArgs e)
//pdf print button
{
//Creating iTextSharp Table from the DataTable data
//Console.WriteLine(drzaveDataGridView.ColumnCount); test za itext sharp
PdfPTable pdfTable =
new
PdfPTable(mktestprobaDataGridView.ColumnCount);
pdfTable.DefaultCell.Padding = 3;
pdfTable.WidthPercentage = 100;
pdfTable.HorizontalAlignment = Element.ALIGN_LEFT;
pdfTable.DefaultCell.BorderWidth = 1;
float
[] sirina =
new
float
[] { 20f, 25f, 45f, 56f, 43f };
pdfTable.SetWidths(sirina);
BaseFont bfCalibri = BaseFont.CreateFont(
"c:\\windows\\fonts\\calibri.ttf"
, BaseFont.IDENTITY_H, BaseFont.EMBEDDED);
iTextSharp.text.Font calibri =
new
iTextSharp.text.Font(bfCalibri, 8);
//Adding Header row
foreach (DataGridViewColumn column in mktestprobaDataGridView.Columns)
{
PdfPCell cell =
new
PdfPCell(
new
Phrase(column.HeaderText));
//cell.BackgroundColor = new iTextSharp.text.Color(240, 240, 240);
pdfTable.AddCell(cell);
}
//Adding DataRow
foreach (DataGridViewRow row in mktestprobaDataGridView.Rows)
{
foreach (DataGridViewCell cell in row.Cells)
{
pdfTable.AddCell(cell.Value.ToString());
}
}
//Exporting to PDF
string folderPath =
"C:\\PDFs\\"
;
if
(!Directory.Exists(folderPath))
{
Directory.CreateDirectory(folderPath);
}
using
(FileStream stream =
new
FileStream(folderPath +
"Drzave.pdf"
, FileMode.Create))
{
iTextSharp.text.Font calibriTitle =
new
iTextSharp.text.Font(bfCalibri, 18);
iTextSharp.text.Font calibriSubTitle =
new
iTextSharp.text.Font(bfCalibri, 14);
Document pdfDoc =
new
Document(PageSize.A4, 10f, 10f, 10f, 0f);
PdfWriter.GetInstance(pdfDoc, stream);
pdfDoc.Open();
// pdfDoc.Add(new Paragraph(korisnik_programa));
// pdfDoc.Add(new Paragraph(adresa));
pdfDoc.Add(pdfTable);
pdfDoc.Close();
stream.Close();
System.Diagnostics.Process.Start(folderPath +
"Drzave.pdf"
);
}
}
Result
Reply
Answers (
4
)
how to explain .net prj in 2 yrs exp intervw without exp ?
multiple chart creation