RDLC(六)_如何在圖片安插文字_文字如何垂直呈現(類似姓名貼紙應用)

 


https://www.hkiou.com/product_list?mcat=name_ticket



在RDLC檔案中簡單用很久之前用過的DataSet和表格佈局










aspx.vb
code-behind部分就是直接塞一個DataTable給它

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
Imports Microsoft.Reporting.WebForms

Public Class 光明燈列印
    Inherits System.Web.UI.Page

    Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
        If Page.IsPostBack = False Then

            Dim dtLightUser As New DataTable
            dtLightUser.Columns.Add("UserName")
            'Dim dr As DataRow = dtLightUser.NewRow
            'dr("UserName") = "劉銘傳"
            'dtLightUser.Rows.Add(dr)

            For idx = 0 To 4
                Dim dr As DataRow = dtLightUser.NewRow
                dr("UserName") = "劉銘傳"
                dtLightUser.Rows.Add(dr)
            Next
            Dim rds As ReportDataSource = New ReportDataSource("DataSet1", dtLightUser)
            Me.rpt_光明燈.LocalReport.DataSources.Clear()
            Me.rpt_光明燈.LocalReport.DataSources.Add(rds)
            Me.rpt_光明燈.LocalReport.Refresh()
        End If
    End Sub

End Class

aspx

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
<%@ Page Language="vb" AutoEventWireup="false" CodeBehind="光明燈列印.aspx.vb" Inherits="WebApplication1.光明燈列印" %>
<%@ Register Assembly="Microsoft.ReportViewer.WebForms" Namespace="Microsoft.Reporting.WebForms" TagPrefix="rsweb" %>
<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
<meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
    <title></title>
</head>
<body>    
    <form id="form1" runat="server">
        <asp:ScriptManager ID="ScriptManager1" runat="server"></asp:ScriptManager>
        <div>            
            <rsweb:reportviewer runat="server" ID="rpt_光明燈" ProcessingMode="Local" ZoomMode="FullPage" SizeToReportContent="true" >
                <LocalReport ReportPath="PrintTemplate\光明燈_列印.rdlc">
                </LocalReport>
            </rsweb:reportviewer>
        </div>
    </form>
</body>
</html>



那要打直的而且不只一個人名怎麼辦

其實一樣也是列印的cell填滿背景圖
然後一個一個cell (每一Row)塞用特定字符分隔的字串
在RDLC (Local Report)用運算式來做Replace換行即可




RDLC當中有提供很多內建運算式幫我們做值的處理










































留言

這個網誌中的熱門文章

何謂淨重(Net Weight)、皮重(Tare Weight)與毛重(Gross Weight)

Architecture(架構) 和 Framework(框架) 有何不同?_軟體設計前的事前規劃的藍圖概念

(2021年度)駕訓學科筆試準備題庫歸納分析_法規是非題