頁面資料匯出為word或者excel
1. 快速匯入方法:
在頁面內加入下面的程式碼
EXCEL
<%
Response.ContentType = "application/vnd.ms-excel";
Response.AddHeader("Content-Disposition", "attachment; filename=FeedBack.xls");
%>
WORD
<%
Response.ContentType = "application/vnd.ms-word";
Response.AddHeader("Content-Disposition", "attachment; filename=FeedBack.doc");
%>
2. 生成的word頁面檢視為web檢視 下面轉化為頁面檢視:
a. <html> 更改:
<html xmlns:v='urn:schemas-microsoft-com:vml' xmlns:o='urn:schemas-microsoft-com:office:office' xmlns:w='urn:schemas-microsoft-com:office:word' xmlns:m='http://schemas.microsoft.com/office/2004/12/omml' xmlns='http://www.w3.org/TR/REC-html40' xmlns='http://www.w3.org/1999/xhtml'>
b. head 內加入下面程式碼:
<!--[if gte mso 9]><xml><w:WordDocument><w:View>Print</w:View><w:TrackMoves>false</w:TrackMoves><w:TrackFormatting/><w:ValidateAgainstSchemas/><w:SaveIfXMLInvalid>false</w:SaveIfXMLInvalid><w:IgnoreMixedContent>false</w:IgnoreMixedContent><w:AlwaysShowPlaceholderText>false</w:AlwaysShowPlaceholderText><w:DoNotPromoteQF/><w:LidThemeOther>EN-US</w:LidThemeOther><w:LidThemeAsian>ZH-CN</w:LidThemeAsian><w:LidThemeComplexScript>X-NONE</w:LidThemeComplexScript><w:Compatibility><w:BreakWrappedTables/><w:SnapToGridInCell/><w:WrapTextWithPunct/><w:UseAsianBreakRules/><w:DontGrowAutofit/><w:SplitPgBreakAndParaMark/><w:DontVertAlignCellWithSp/><w:DontBreakConstrainedForcedTables/><w:DontVertAlignInTxbx/><w:Word11KerningPairs/><w:CachedColBalance/><w:UseFELayout/></w:Compatibility><w:BrowserLevel>MicrosoftInternetExplorer4</w:BrowserLevel><m:mathPr><m:mathFont m:val="Cambria Math"/><m:brkBin m:val="before"/><m:brkBinSub m:val="--"/><m:smallFrac m:val="off"/><m:dispDef/><m:lMargin m:val="0"/> <m:rMargin m:val="0"/><m:defJc m:val="centerGroup"/><m:wrapIndent m:val="1440"/><m:intLim m:val="subSup"/><m:naryLim m:val="undOvr"/></m:mathPr></w:WordDocument></xml><![endif]-->
OK了!
ps:記得html不能引入外部css檔案 都寫在一個檔案中,這樣word檔案才能取到頁面樣式。
3.如果你的頁面用的form runat=‘server’標籤 並且設定顯示編輯標記,那麼可能會出現如下不如人意的效果,刪掉form標籤即可。
相關文章
- C# word或者excel儲存或匯出為PDFC#Excel
- 資料匯出為excel表格Excel
- 匯出Excel或word文件Excel
- 模板匯出word和 EXcelExcel
- 將資料庫中資料匯出為excel表格資料庫Excel
- node 抓取api資料匯出為excel表格APIExcel
- NPOI匯出和匯入Excel,Word和PDFExcel
- 資料庫文件編寫,如何通過Navicat把表導成表格?資料庫快速匯出為excel表格資訊,excel匯出到word表格資料庫Excel
- php匯出資料excelPHPExcel
- vue+element + table將選中的資料匯出為excel(匯出的是當前頁選中的資料)VueExcel
- excel匯出、mysql分頁ExcelMySql
- EasyPoi, Excel資料的匯入匯出Excel
- 大資料使用Excel匯出大資料Excel
- python django框架前端頁面支援匯出excel檔案PythonDjango框架前端Excel
- php生成匯出Word、Excel、PowerPoint外掛PHPExcel
- 用php把資料匯出excelPHPExcel
- vue匯出excel資料表格功能VueExcel
- 將table表格內容匯入到word或者Excel程式碼例項Excel
- 照Word模版匯入匯出資料的設計
- expdp中使用include或者exclude匯出資料
- SQL SERVER 和EXCEL的資料匯入匯出SQLServerExcel
- 微信小程式之匯出頁面為doc檔案微信小程式
- vue2.0 匯出Excel表格資料VueExcel
- vue將表格匯出為excelVueExcel
- ASP.NET EXCEL資料的匯出和匯入ASP.NETExcel
- 將Excel檔案匯入資料庫(POI+Excel+MySQL+jsp頁面匯入)第一次優化Excel資料庫MySqlJS優化
- 如何實現 mysql 匯出資料,驗證頁面正確性?MySql
- Excel怎樣連結到word文件中指定的頁面Excel
- 百萬級別資料Excel匯出優化Excel優化
- Dcat admin使用Laravel Excel匯出資料LaravelExcel
- ORACLE資料表匯出成EXCEL格式(ODBC)OracleExcel
- 匯出資料為csv格式
- 匯出excelExcel
- 原生PHP網頁匯出和匯入excel檔案例項PHP網頁Excel
- php讀取excel檔案資料的匯入和匯出PHPExcel
- excel表格匯入word方法彙總Excel
- php如何將資料匯出成excel表格呢?PHPExcel
- vue+element將資料匯出成excel表格VueExcel