簡介
製作報表往往會把具"群組性資料"做分頁。列印整批學生成績單為例,每位「學生」是分群組的基本單位。學生會有自己的成績單,不會和其他同學的資料混再一起。本文介紹如何透過網頁技術將資料於列印時分頁。
範例:網頁分頁
關鍵字:
- CSS @media print
- page_break
執行網頁看到是這樣的。
data-role of "page". index.html#foo) on a page in jQuery Mobile, because the framework will look for a 'page' with an ID of #foo instead of the native behavior of scrolling to the content with that ID.id attribute of all your elements must be not only unique on a given page, but also unique across the pages in a site. This is because jQuery Mobile's single-page navigation model allows many different "pages" to be present in the DOM at the same time. This also applies when using a multi-page template, since all "pages" on the template are loaded at once
// 匿名物件
var person = { pid: 'A123456789' };
// 匿名物件轉為 JSON 字串
var params = JSON.stringify( person );
$.ajax({
type: "POST",
url: "../../WebService.asmx/FindPerson", // WEB SERVICE
data: params, // 參數
contentType: "application/json; charset=utf-8", // 參數格式
dataType: "json", // 回傳格式
success: function(response) {
// 將 WEB SERVICE 回傳的字串轉為物件
var jsonObj = $.parseJSON(response.d);
// 使用 chrome 按 F12 選擇 console 即可看到結果
console.log("Hello, I am " + jsonObj.name);
} // ajax 執行成功
, failure: function(msg) { } // ajax 執行失敗
,error: function(msg) { } // ajax 執行發生錯誤
});
// WEB SERVICE
<WebMethod(True)> _
Public Function FindPerson(ByVal pid As String) As String
// DB 取出 Person 物件資料(附註DataTable轉Object可參考LINQ)
Dim pObj AS Person = db.SelectPerson(pid)
// 將物件序列化為字串
Return New JavaScriptSerializer().Serialize( pObj )
End Function
// 物件
Class Person
Public name As String
End Class