From 99805031b12f1084dd10b4a7d131bae00d8d05ad Mon Sep 17 00:00:00 2001 From: Kurt Jung Date: Tue, 6 Aug 2013 12:05:03 -0400 Subject: Tutorial 10 exercises some uncommon functions as reported by gocov. --- fpdf.go | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) (limited to 'fpdf.go') diff --git a/fpdf.go b/fpdf.go index e192c51..493e98e 100644 --- a/fpdf.go +++ b/fpdf.go @@ -1040,10 +1040,16 @@ func (f *Fpdf) CellFormat(w, h float64, txtStr string, borderStr string, ln int, // A simpler version of CellFormat with no fill, border, links or special // alignment. func (f *Fpdf) Cell(w, h float64, txtStr string) { - // dbg("Cell. h is %.2f", h) f.CellFormat(w, h, txtStr, "", 0, "L", false, 0, "") } +// A simpler printf-style version of CellFormat with no fill, border, links or +// special alignment. See documentation for the fmt package for details on +// fmtStr and args. +func (f *Fpdf) Cellf(w, h float64, fmtStr string, args ...interface{}) { + f.CellFormat(w, h, sprintf(fmtStr, args...), "", 0, "L", false, 0, "") +} + // This method allows printing text with line breaks. They can be automatic (as // soon as the text reaches the right border of the cell) or explicit (via the // \n character). As many cells as necessary are output, one below the other. @@ -1263,6 +1269,12 @@ func (f *Fpdf) Write(h float64, txtStr string) { f.write(h, txtStr, 0, "") } +// Like Write but uses printf-style formatting. See the documentation for +// pckage fmt for mor details on fmtStr and args. +func (f *Fpdf) Writef(h float64, fmtStr string, args ...interface{}) { + f.write(h, sprintf(fmtStr, args...), 0, "") +} + // Write text that when clicked launches an external URL. See Write() for // argument details. func (f *Fpdf) WriteLinkString(h float64, displayStr, targetStr string) { -- cgit v1.2.1-24-ge1ad