我想在一個PdfPCell中添加多個短語。 我擔心的是,我想在一個單元格中以灰色字體顯示像 「創建日期:」,並且以黑色字體顯示「日期」。一個PdfPCell中的多個短語
那麼,有沒有辦法做到這一點?請幫忙。
代碼是這樣,
PdfPCell cell = new PdfPCell(new Phrase("Created Date : ",grayFont));
現在,我想以後添加日期不增加新的細胞。那可能嗎?
我想在一個PdfPCell中添加多個短語。 我擔心的是,我想在一個單元格中以灰色字體顯示像 「創建日期:」,並且以黑色字體顯示「日期」。一個PdfPCell中的多個短語
那麼,有沒有辦法做到這一點?請幫忙。
代碼是這樣,
PdfPCell cell = new PdfPCell(new Phrase("Created Date : ",grayFont));
現在,我想以後添加日期不增加新的細胞。那可能嗎?
使用
Phrase datePhrase = new Phrase(new Chunk("Created Date", FontFactory.getFont(FontFactory.HELVETICA, 16, Font.BOLD, BaseColor.GRAY)));
datePhrase.add(new Phrase(new Chunk("Your Date", FontFactory.getFont(FontFactory.HELVETICA, 16, Font.BOLD, BaseColor.BLACK))));
PdfPCell cell = new PdfPCell(datePhrase);
謝謝,好方法,但我會這樣做︰datePhrase.add(new Chunk(「Your Date」,FontFactory.getFont(FontFactory.HELVETICA,16,Font.BOLD,BaseColor.BLACK))); – 2016-09-20 22:20:49
添加一個表格圍繞這兩個值。 – Jens 2014-10-02 11:07:14
我不想使用另一個單元格或表格。因爲我在一個有多行和多列的表中這樣做。 – 2014-10-02 11:08:48
比我瘦是不可能的。 – Jens 2014-10-02 11:11:23