日韩性视频-久久久蜜桃-www中文字幕-在线中文字幕av-亚洲欧美一区二区三区四区-撸久久-香蕉视频一区-久久无码精品丰满人妻-国产高潮av-激情福利社-日韩av网址大全-国产精品久久999-日本五十路在线-性欧美在线-久久99精品波多结衣一区-男女午夜免费视频-黑人极品ⅴideos精品欧美棵-人人妻人人澡人人爽精品欧美一区-日韩一区在线看-欧美a级在线免费观看

歡迎訪問 生活随笔!

生活随笔

當前位置: 首頁 > 编程资源 > 编程问答 >内容正文

编程问答

Aspose.cell生成表格

發布時間:2024/4/14 编程问答 30 豆豆
生活随笔 收集整理的這篇文章主要介紹了 Aspose.cell生成表格 小編覺得挺不錯的,現在分享給大家,幫大家做個參考.
public?void?ExportQueryPrj(HttpContext?context){?//接受前端傳遞參數和數據string?datasource?=?context.Request["queryResult"];?//序列化后的json字符串List<QueryXM>?queryList?=?JSONStringToList<QueryXM>(datasource);????//反序列化json字符串為listif?(queryList.Count?>?0){Workbook?workbook?=?new?Workbook();//工作薄Worksheet?worksheet?=?workbook.Worksheets[0];//工作表Cells?cells?=?worksheet.Cells;//單元格//表頭部分cells[0,?0].PutValue("索引值");cells[0,?1].PutValue("項目ID");cells[0,?2].PutValue("用地位置");cells[0,?3].PutValue("項目名稱");cells[0,?4].PutValue("建設單位");cells[0,?5].PutValue("用地性質");cells[0,?6].PutValue("用地面積");cells[0,?7].PutValue("項目類型");cells[0,?8].PutValue("紅線類別");cells[0,?9].PutValue("用地分類");cells[0,?10].PutValue("BELONGTFZX");cells[0,?11].PutValue("TDCRSTATUS");cells[0,?12].PutValue("TDYT");cells[0,?13].PutValue("JSYDFL");//調整寬度cells.SetColumnWidth(2,?40);cells.SetColumnWidth(3,?60);cells.SetColumnWidth(4,?80);cells.SetColumnWidth(7,?40);cells.SetColumnWidth(8,?20);//內容for?(int?i?=?0;?i?<?queryList.Count;?i++){cells[i+1,?0].PutValue(queryList[i].OBJECTID);cells[i?+?1,?1].PutValue(queryList[i].PrjID);cells[i?+?1,?2].PutValue(queryList[i].FADDRESS);cells[i?+?1,?3].PutValue(queryList[i].PRJNAME);cells[i?+?1,?4].PutValue(queryList[i].FCOMPANY);cells[i?+?1,?5].PutValue(queryList[i].YDXZ);cells[i?+?1,?6].PutValue(queryList[i].YDMJ);cells[i?+?1,?7].PutValue(queryList[i].XMLX);cells[i?+?1,?8].PutValue(queryList[i].TYPE);cells[i?+?1,?9].PutValue(queryList[i].YDFL);cells[i?+?1,?10].PutValue(queryList[i].BELONGTFZX);cells[i?+?1,?11].PutValue(queryList[i].TDCRSTATUS);cells[i?+?1,?12].PutValue(queryList[i].TDYT);cells[i?+?1,?13].PutValue(queryList[i].JSYDFL);cells.SetRowHeight(i?+?1,?25);??//設置行高}string?filepath=?"../Aspose/QueryExcel/項目查詢報告"+DateTime.Now.ToString("yyyymmddHHmmss")+".xls";string?fileServerPath?=?context.Server.MapPath(filepath);if?(!File.Exists(fileServerPath)){var?myfile?=?File.Create(fileServerPath);myfile.Close();}workbook.Save(fileServerPath);//按照json格式返回前端數據ResponseResult?response?=?new?ResponseResult()?{?responseMark?=?1,?responseObject?=?filepath?};context.Response.Write(new?JavaScriptSerializer().Serialize(response));}}

轉載于:https://www.cnblogs.com/sguozeng/p/9230514.html

總結

以上是生活随笔為你收集整理的Aspose.cell生成表格的全部內容,希望文章能夠幫你解決所遇到的問題。

如果覺得生活随笔網站內容還不錯,歡迎將生活随笔推薦給好友。