Created
January 25, 2019 15:41
-
-
Save SeppPenner/f65dcdfe7e51ce0d58b710f9dd0510ff to your computer and use it in GitHub Desktop.
How can I disable the splitting of rows (not tables!) in Itext7 for C# when one row is to big to fit on the first page?
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
namespace PrueDi.Export.Pdf | |
{ | |
using iText.Layout.Element; | |
using iText.Layout.Layout; | |
using iText.Layout.Renderer; | |
public class CustomCellRenderer : CellRenderer | |
{ | |
public CustomCellRenderer(Cell modelElement) : base(modelElement) | |
{ | |
} | |
public override LayoutResult Layout(LayoutContext layoutContext) | |
{ | |
var result = base.Layout(layoutContext); | |
if (LayoutResult.FULL == result.GetStatus()) | |
{ | |
return result; | |
} | |
result.SetStatus(LayoutResult.NOTHING); | |
result.SetSplitRenderer(null); | |
result.SetOverflowRenderer(this); | |
return result; | |
} | |
public override IRenderer GetNextRenderer() | |
{ | |
return new CustomCellRenderer((Cell)this.GetModelElement()); | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment