1
이 질문둥근 셀을 배경색으로 소개하는 방법은 무엇입니까?
How to create a rounded corner table using iText\iTextSharp?
에서 테이블의 셀에 대한 둥근 테두리를 설정하지만 국경, 그러나 색깔의 둥근 배경을 미치지 않습니다 셀을 만들 수 있습니다하는 방법을 보았는가?
이 질문둥근 셀을 배경색으로 소개하는 방법은 무엇입니까?
How to create a rounded corner table using iText\iTextSharp?
에서 테이블의 셀에 대한 둥근 테두리를 설정하지만 국경, 그러나 색깔의 둥근 배경을 미치지 않습니다 셀을 만들 수 있습니다하는 방법을 보았는가?
이를 달성하려면 cell events이 필요합니다. 내 책에 여러 가지 예를 제시했습니다. 예를 calendar.pdf를 참조하십시오 :
이자바 코드가 백혈구를 만드는 것은 다음과 같습니다
이 코드의 C# 버전에 대한class CellBackground implements PdfPCellEvent {
public void cellLayout(PdfPCell cell, Rectangle rect,
PdfContentByte[] canvas) {
PdfContentByte cb = canvas[PdfPTable.BACKGROUNDCANVAS];
cb.roundRectangle(
rect.getLeft() + 1.5f, rect.getBottom() + 1.5f, rect.getWidth() - 3,
rect.getHeight() - 3, 4);
cb.setCMYKColorFill(0x00, 0x00, 0x00, 0x00);
cb.fill();
}
}
, Where do I find the C# examples?에 가서 장을 클릭하는 예제의 Java 버전의 장에 해당합니다. 예를 들어
, PdfCalendar.cs :
class CellBackground : IPdfPCellEvent {
public void CellLayout(
PdfPCell cell, Rectangle rect, PdfContentByte[] canvas
) {
PdfContentByte cb = canvas[PdfPTable.BACKGROUNDCANVAS];
cb.RoundRectangle(
rect.Left + 1.5f,
rect.Bottom + 1.5f,
rect.Width - 3,
rect.Height - 3, 4
);
cb.SetCMYKColorFill(0x00, 0x00, 0x00, 0x00);
cb.Fill();
}
}
는이 같은 이벤트를 사용할 수 있습니다
CellBackground cellBackground = new CellBackground();
cell.CellEvent = cellBackground;
이제 CellLayout()
방법은 셀이 페이지로 렌더링되는 순간 실행됩니다.