這篇文章將為大家詳細講解有關.net core項目中常用的類庫有哪些,小編覺得挺實用的,因此分享給大家做個參考,希望大家閱讀完這篇文章后可以有所收獲。
創(chuàng)新互聯公司專注為客戶提供全方位的互聯網綜合服務,包含不限于做網站、網站制作、淅川網絡推廣、微信小程序、淅川網絡營銷、淅川企業(yè)策劃、淅川品牌公關、搜索引擎seo、人物專訪、企業(yè)宣傳片、企業(yè)代運營等,從售前售中售后,我們都將竭誠為您服務,您的肯定,是我們大的嘉獎;創(chuàng)新互聯公司為所有大學生創(chuàng)業(yè)者提供淅川建站搭建服務,24小時服務熱線:18980820575,官方網址:muchs.cn漢字轉拼音
1、 HxfPinYin
這是我自己根據網上大神提供的源碼,再。net core 框架下編譯出的類庫
主要提供漢字轉拼音的功能。
使用
public static class Pinyin { public static string ConvertEncoding(string text, Encoding srcEncoding, Encoding dstEncoding); public static string GetChineseText(string pinyin); public static string GetChineseText(string pinyin, Encoding encoding); public static string GetInitials(string text); public static string GetInitials(string text, Encoding encoding); public static string GetPinyin(string text); public static string GetPinyin(string text, Encoding encoding); public static string GetPinyin(char ch); public static string GetPinyin(char ch, Encoding encoding); }
excel操作
1、EPPlus.Core
生成excel表格
string sFileName = $"{Guid.NewGuid()}.xlsx"; FileInfo file = new FileInfo(sFileName); string[] title = { "貨品編號", "貨品名稱", "條碼", "規(guī)格", "基本單位", "當前庫存", "庫存下限", "庫存上限" }; using (ExcelPackage package = new ExcelPackage(file)) { ExcelWorksheet worksheet = package.Workbook.Worksheets.Add("庫存信息"); int index = 1; foreach (string t in title) { worksheet.Cells[1, index++].Value = t; } index = 2; foreach (var d in list) { worksheet.Cells[index,1].Value = d.ProductCode; worksheet.Cells[index, 2].Value = d.ProductName; worksheet.Cells[index, 3].Value = d.BarCode; worksheet.Cells[index, 4].Value = d.SpecValues; worksheet.Cells[index, 5].Value = d.BaseUnit; worksheet.Cells[index, 6].Value = d.Quantity; worksheet.Cells[index, 7].Value = d.DownLimitQuantity; worksheet.Cells[index, 8].Value = d.UpLimitQuantity; index++; } package.Save(); }
pdf操作
1、iTextSharp.LGPLv2.Core
生成pdf
string tempFilePath = $"{Guid.NewGuid()}.pdf"; string[] title = { "貨品編號", "貨品名稱", "條碼", "規(guī)格", "基本單位", "當前庫存", "庫存下限", "庫存上限" }; using (FileStream wfs = new FileStream(tempFilePath, FileMode.OpenOrCreate)) { //PageSize.A4.Rotate();當需要把PDF紙張設置為橫向時 Document docPDF = new Document(PageSize.A4,10, 10, 20,20); PdfWriter write = PdfWriter.GetInstance(docPDF, wfs); docPDF.Open(); //在這里需要注意的是,itextsharp不支持中文字符,想要顯示中文字符的話需要自己設置字體 BaseFont bsFont = BaseFont.CreateFont(@"C:\Windows\Fonts\simsun.ttc,0", BaseFont.IDENTITY_H, BaseFont.EMBEDDED); Font font = new Font(bsFont); float[] clos = new float[] { 40,40,40,20,20,30,30,30};// 寬度 PdfPTable tablerow1 = new PdfPTable(clos); foreach (string t in title) { PdfPCell cell = new PdfPCell(new Paragraph(t, font)); cell.MinimumHeight = 4f; tablerow1.AddCell(cell); } foreach (var d in list) { tablerow1.AddCell(new PdfPCell(new Paragraph(d.ProductCode, font))); tablerow1.AddCell(new PdfPCell(new Paragraph(d.ProductName, font))); tablerow1.AddCell(new PdfPCell(new Paragraph(d.BarCode, font))); tablerow1.AddCell(new PdfPCell(new Paragraph(d.SpecValues, font))); tablerow1.AddCell(new PdfPCell(new Paragraph(d.BaseUnit, font))); tablerow1.AddCell(new PdfPCell(new Paragraph(d.Quantity.ToString(), font))); tablerow1.AddCell(new PdfPCell(new Paragraph(d.DownLimitQuantity.ToString(), font))); tablerow1.AddCell(new PdfPCell(new Paragraph(d.UpLimitQuantity.ToString(), font))); } docPDF.Add(tablerow1);//將表格添加到pdf文檔中 docPDF.Close();//關閉 write.Close(); wfs.Close(); }
關于“.net core項目中常用的類庫有哪些”這篇文章就分享到這里了,希望以上內容可以對大家有一定的幫助,使各位可以學到更多知識,如果覺得文章不錯,請把它分享出去讓更多的人看到。
當前題目:.netcore項目中常用的類庫有哪些-創(chuàng)新互聯
URL網址:http://muchs.cn/article20/degcco.html
成都網站建設公司_創(chuàng)新互聯,為您提供網站營銷、移動網站建設、網頁設計公司、微信公眾號、面包屑導航、響應式網站
聲明:本網站發(fā)布的內容(圖片、視頻和文字)以用戶投稿、用戶轉載內容為主,如果涉及侵權請盡快告知,我們將會在第一時間刪除。文章觀點不代表本網站立場,如需處理請聯系客服。電話:028-86922220;郵箱:631063699@qq.com。內容未經允許不得轉載,或轉載時需注明來源: 創(chuàng)新互聯