1

我使用小册子插件为我的内容制作翻书效果Web Browser,所以一切都很好。

我从 db 检索我的文本数据我想编写一个函数,将文本(已经从 db 检索到)转换为页面,例如,如果我的文本量大于页面,它会将其余文本放在下一页等等.

html代码

<html >
<head>
    <!-- page css -->
    <link href="Booklet%20-%20jQuery%20Plugin_files/base0000.css" type="text/css" rel="stylesheet" media="screen, projection, tv">
    <link href="Booklet%20-%20jQuery%20Plugin_files/booklet0.css" type="text/css" rel="stylesheet" media="screen, projection, tv">

    <!-- required files for booklet -->
    <script src="Booklet%20-%20jQuery%20Plugin_files/jquery00.js" type="text/javascript"></script>
    <script src="Booklet%20-%20jQuery%20Plugin_files/jquery-u.js" type="text/javascript"></script>
    <script src="Booklet%20-%20jQuery%20Plugin_files/jquery01.js" type="text/javascript"></script>
    <script src="Booklet%20-%20jQuery%20Plugin_files/jquery02.js" type="text/javascript"></script>
    <link href="Booklet%20-%20jQuery%20Plugin_files/jquery00.css" type="text/css" rel="stylesheet" media="screen, projection, tv">

    <!-- basic initialization -->
    <script type="text/javascript">
    function mm() {
        $('#mybook').booklet();
    };
    </script>
</head>
<body >
<div id="mybook">
<div>page 1 content<div>//If my page content was larger than page put rest of text to next page
<div>page 2 content<div>
<div>page 3 content<div>
.
.
.
<div>
</body>
</html>

我怎样才能做到这一点?

4

1 回答 1

0

据我了解,一旦加载文档,您就必须执行以下操作:

var bookDiv = yourWebBrowserControl.Document.GetElementById["mybook"];

IEnumerable<string> theBook = getTheDataFromDb();
var sites = SplitTheBookIntoSites();

foreach (var site in sites)
{
  var bookSiteDiv = yourWebBrowserControl.Document.CreateElement("div");
  bookSiteDiv.InnerText = theSite;
  bookDiv.AppendChild(bookSiteDiv);
}

要拆分字符串,您可以使用此处提供的解决方案之一。为了在每个站点上都有固定的字符串大小,您必须选择像 Courier 这样的等宽字体

于 2012-09-24T13:24:28.923 回答