短日期格式
VB
FormatDateTime(TextBox1.Text, DateFormat.ShortDate)C#
DateTime strDate = DateTime.Parse(TextBox1.Text)
String.Format(“{0:yyyy/MM/dd}", strDate)
public void tif2pdf(string TifFN, string PdfFN)
{
iTextSharp.text.Image image;
//設定4個邊界
int Mleft = 0;
int Mright = 0;
int Mtop = 0;
int Mbottom = 0;
Document document = new Document(iTextSharp.text.PageSize.A4, Mleft, Mright, Mtop, Mbottom);
PdfWriter.GetInstance(document, new FileStream(PdfFN, FileMode.Create));
document.Open();
image = iTextSharp.text.Image.GetInstance(TifFN);
//調整圖片大小,使之適合A4
if (image.Height > iTextSharp.text.PageSize.A4.Height - Mtop)
image.ScaleToFit(iTextSharp.text.PageSize.A4.Width - Mleft, iTextSharp.text.PageSize.A4.Height - Mtop);
else if (image.Width > iTextSharp.text.PageSize.A4.Width - Mleft)
image.ScaleToFit(iTextSharp.text.PageSize.A4.Width - Mleft, iTextSharp.text.PageSize.A4.Height - Mtop);
//調整圖片位置,使之居中
image.Alignment = iTextSharp.text.Image.ALIGN_MIDDLE;
document.NewPage();
document.Add(image);
document.Close();
}
第二段寫法:自動分頁列印! <SCRIPT LANGUAGE='JavaScript'> </SCRIPT>這是列印的第一頁! 這是列印的第二頁!
第三段寫法:第一頁第二頁
第一頁第二頁
< ?php
$number = 123;
$txt = sprintf("With 2 decimals: %1\$.2f
With no decimals: %1\$u",$number);
echo $txt."<br>";
echo sprintf("%05d", 1);
?>
輸出:
With 2 decimals: 123.00
With no decimals: 123
00001