日韩无码专区无码一级三级片|91人人爱网站中日韩无码电影|厨房大战丰满熟妇|AV高清无码在线免费观看|另类AV日韩少妇熟女|中文日本大黄一级黄色片|色情在线视频免费|亚洲成人特黄a片|黄片wwwav色图欧美|欧亚乱色一区二区三区

RELATEED CONSULTING
相關(guān)咨詢
選擇下列產(chǎn)品馬上在線溝通
服務(wù)時間:8:30-17:00
你可能遇到了下面的問題
關(guān)閉右側(cè)工具欄

新聞中心

這里有您想知道的互聯(lián)網(wǎng)營銷解決方案
silverlight仿“百度文庫”的文檔控件

通用的FlashPaper支持Word/Excel/PDF,到時對于Silverlight的XPS的文檔支持問題比較多,本控件提供了一個可視化的XPS文檔展示,提供放大縮小/打印/搜索/分頁等功能,主要整合了開源的Document Toolkit。

10年積累的網(wǎng)站建設(shè)、網(wǎng)站設(shè)計經(jīng)驗,可以快速應(yīng)對客戶對網(wǎng)站的新想法和需求。提供各種問題對應(yīng)的解決方案。讓選擇我們的客戶得到更好、更有力的網(wǎng)絡(luò)服務(wù)。我雖然不認(rèn)識你,你也不認(rèn)識我。但先網(wǎng)站設(shè)計后付款的網(wǎng)站建設(shè)流程,更有汾西免費網(wǎng)站建設(shè)讓你可以放心的選擇與我們合作。

1. 使用Document Toolkit,DocumentDataSource提供數(shù)據(jù)源,PageNvaigator提供分頁 :

   
 
 
 
  1.  
  2.  
  3.           
  4.  
  5.         
  6.                     PageCount="{Binding PageCount, ElementName=viewer}" 
  7.                     PageIndex="{Binding PageIndex, ElementName=viewer, Mode=TwoWay}" 
  8.                     />  
  9.                   
  10.          

2. WebPackageReader讀取本地xps或遠程xps文件作為數(shù)據(jù)源

DotNetZipPackageReader 根據(jù)分頁延遲加載文檔

   
 
 
 
  1. // loads the sample XPS document from the web  
  2.             var url = string.Format("/DocumentService.ashx?id={0}", HtmlPage.Document.GetElementById("documentId").GetProperty("value"));  
  3.             webClient.OpenReadAsync(new Uri(HtmlPage.Document.DocumentUri, url));   
  4.             var reader = new WebPackageReader(new Uri(HtmlPage.Document.DocumentUri, url + "&part="));  
  5.             this.dataSource.PackageReader = reader;  
  6.             var xpsClient = new XpsClient();  
  7.             xpsClient.LoadXpsDocumentAsync(reader); 

3. 服務(wù)端根據(jù)請求的文件ID和當(dāng)前頁碼返回指定的文件流

   
 
 
 
  1. private void Response(HttpContext context, string xpsFileName, string partName)  
  2.         {  
  3.             using (FileStream stream = File.OpenRead(xpsFileName))  
  4.             {  
  5.                 ZipFile file = new ZipFile(stream);  
  6.                 ZipEntry entry = file.GetEntry(partName);  
  7.                 if (entry != null)  
  8.                 {  
  9.                     using (Stream entryStream = file.GetInputStream(entry))  
  10.                     {  
  11.                         // TODO: set mime-type as defined in XPS package  
  12.                         context.Response.ContentType = "application/octet-stream";  
  13.                         byte[] buffer = new byte[2 << 14];    // write blocks of 32768 bytes  
  14.                         int read;  
  15.                         while ((read = entryStream.Read(buffer, 0, buffer.Length)) > 0)  
  16.                         {  
  17.                             context.Response.OutputStream.Write(buffer, 0, read);  
  18.                         }  
  19.                     }  
  20.                 }  
  21.                 else 
  22.                 {  
  23.                     // return 404 Not Found  
  24.                     context.Response.StatusCode = (int)HttpStatusCode.NotFound;  
  25.                 }  
  26.             }  
  27.  
  28.         } 

4. 源代碼下載

點擊

5. 在線預(yù)覽

http://rapidsl2.guozili.25u.com/  (admin/admin  點左邊菜單 控件展示 - 文檔查看器)

6. 截圖


網(wǎng)頁標(biāo)題:silverlight仿“百度文庫”的文檔控件
本文地址:http://www.5511xx.com/article/codihei.html