私は次のコードを持っています。その出力はpdfファイルです:
フォーム MTR 17
官報の支払い請求書
DDO Code: 703
コードは次のとおりです。
using System;
using System.Collections;
using System.Configuration;
using System.Data;
using System.Linq;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.HtmlControls;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Xml.Linq;
using System.IO;
using iTextSharp.text;
using iTextSharp.text.pdf;
public partial class new_salary : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{
}
protected void Button1_Click(object sender, EventArgs e)
{
HttpContext.Current.Response.Clear();
HttpContext.Current.Response.ContentType = "application/pdf";
// Create PDF document
Document pdfDocument = new Document(PageSize.A4, 70, 45, 40, 25);
PdfWriter wri = PdfWriter.GetInstance(pdfDocument, new FileStream("d://JudgeSalary.pdf", FileMode.Create));
PdfWriter.GetInstance(pdfDocument, HttpContext.Current.Response.OutputStream);
pdfDocument.Open();
Chunk boo = new Chunk("Form M.T.R. 17");
Paragraph main1 = new Paragraph("Form M.T.R. 17 \nPAY-BILL OF GAZETTED OFFICER");
main1.Alignment = Element.ALIGN_CENTER;
main1.Font.SetStyle(Font.BOLD);
Paragraph main1a = new Paragraph(" DDO Code: 703");
main1a.Alignment = Element.ALIGN_RIGHT;
pdfDocument.Add(main1);
pdfDocument.Add(main1a);
pdfDocument.Close();
HttpContext.Current.Response.End();
}
}
出力を次のようにしたい:
**Form M.T.R. 17**
**PAY-BILL OF GAZETTED OFFICER** DDO Code: 703
段落の 2 行目に「DDO コード: 703」があり、テキストの書式設定がない場合、上記の出力を取得するにはどうすればよいですか。「para1」に「DDO Code: 703」を含めると、テキストが太字で表示されます。この出力を中央揃えにして、右揃えにしたい「DDOコード:703」を受け入れます。
太字にしたくないし、段落の 2 行目に入れたい。どうすればできますか?