本文整理匯總了Golang中github.com/mikeshimura/goreport.GoReport類的典型用法代碼示例。如果您正苦於以下問題:Golang GoReport類的具體用法?Golang GoReport怎麽用?Golang GoReport使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。
在下文中一共展示了GoReport類的4個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Golang代碼示例。
示例1: Execute
func (h M1G2Summary) Execute(report gr.GoReport) {
report.Cell(150, 2, "Dept Total")
report.CellRight(180, 2, 30, strconv.FormatFloat(
report.SumWork["g2cum"], 'f', 2, 64))
report.SumWork["g2cum"] = 0.0
//Force New Page
report.NewPage(false)
}
示例2: Execute
func (h C1Detail) Execute(report gr.GoReport) {
cols := report.Records[report.DataPos].([]string)
y := 2.0
report.Font("IPAexG", 9, "")
report.Cell(14, y, cols[5])
report.Cell(40, y, cols[6])
hr := gr.ParseFloatPanic(cols[7])
report.CellRight(150, y, 20, gr.AddComma(strconv.FormatFloat(hr, 'f', 1, 64))+" Hrs")
amt := gr.ParseFloatPanic(cols[8])
report.CellRight(170, y, 26, gr.AddComma(strconv.FormatFloat(amt, 'f', 2, 64))+" USD")
report.SumWork["g1amtcum"] += amt
report.SumWork["g2amtcum"] += amt
report.SumWork["g1hrcum"] += hr
report.SumWork["g2hrcum"] += hr
}
示例3: Execute
func (h C2Header) Execute(report gr.GoReport) {
cols := report.Records[report.DataPos].([]string)
y := 32.0
x := 25.0
if report.SumWork["g2item"] == 0.0 {
numConv := unicode.SpecialCase{
// 半角の 0 から 9 に対する変換ルール
unicode.CaseRange{
0x0030, // Lo: 半角の 0
0x0039, // Hi: 半角の 9
[unicode.MaxCase]rune{
0xff10 - 0x0030, // UpperCase で全角に変換
0, // LowerCase では変換しない
0xff10 - 0x0030, // TitleCase で全角に変換
},
},
}
report.Font("IPAexゴシック", 10, "")
now := strings.ToUpperSpecial(
numConv, time.Now().Format(C2DateFormat))
report.CellRight(182, 12, 0, now)
report.CellRight(182, 19, 0, "請求書番號:"+cols[2])
report.Font("IPAexゴシック", 16, "")
report.Cell(92, 30, "請求書")
report.Font("IPAexゴシック", 11, "")
x = 118.0
report.Cell(x, 46, "サンプル商事株式會社")
report.Cell(x, 51, "山田太郎")
report.Font("IPAexゴシック", 9, "")
report.Cell(x, 58, "〒181-0001")
report.Cell(x, 62, "東京都三鷹市井の頭5-12-12")
report.Cell(x, 72, "TEL:0422-22-2222")
report.Cell(x, 76, "FAX:0422-22-2223")
report.Cell(x, 80, "[email protected]")
cols = cols
x = 25
report.Font("IPAexゴシック", 12, "")
company := cols[1] + " 禦中"
// 注意 Pdf.SetFontは呼び出し順が違う
report.Converter.Pdf.SetFont("IPAexゴシック", "", 12)
w, _ := report.Converter.Pdf.MeasureTextWidth(company)
report.Cell(x, 46, company)
report.LineType("straight", 0.3)
report.GrayStroke(0.5)
report.LineH(x, 50, x+w/report.ConvPt)
report.Font("IPAexゴシック", 9, "")
report.Cell(x, 58, "下記のとおりご請求申し上げます。")
report.Font("IPAexゴシック", 12, "")
report.Cell(x, 70, "ご請求金額")
report.CellRight(x+72, 70, 0, "¥"+gr.AddComma(cols[10])+"-")
report.LineH(x, 74, x+72)
report.GrayStroke(0)
y = 85
}
report.LineType("straight", 5)
report.GrayStroke(0.85)
report.LineH(x, y, x+160)
report.LineType("straight", 0.3)
report.GrayStroke(0)
report.Rect(x, y, x+160, y+5)
report.LineV(x+23, y, y+5)
report.LineV(x+41, y, y+5)
report.LineV(x+61, y, y+5)
report.LineV(x+99, y, y+5)
report.LineV(x+116, y, y+5)
report.LineV(x+135, y, y+5)
report.Font("IPAexゴシック", 10, "")
yadd := 1.5
report.Cell(x+5, y+yadd, "年月日")
report.Cell(x+28, y+yadd, "伝票")
report.Cell(x+47, y+yadd, "品番")
report.Cell(x+76, y+yadd, "品名")
report.Cell(x+104, y+yadd, "數量")
report.Cell(x+122, y+yadd, "単価")
report.Cell(x+144, y+yadd, "金額")
report.SumWork["g1item"] = 0.0
report.SumWork["g2item"] = 1.0
}
示例4: Execute
func (h S1Header) Execute(report gr.GoReport) {
report.Font("IPAexG", 14, "")
report.Cell(50, 15, "Sales Report")
report.Font("IPAexG", 12, "")
report.Cell(240, 20, "page")
report.Cell(260, 20, strconv.Itoa(report.Page))
y := 23.0
report.Cell(15, y, "D No")
report.Cell(30, y, "Dept")
report.Cell(60, y, "Order")
report.Cell(90, y, "Stock")
report.Cell(120, y, "Name")
report.CellRight(135, y, 25, "Unit Price")
report.CellRight(160, y, 20, "Qty")
report.CellRight(190, y, 20, "Amount")
}