欧美一区二区三区老妇人-欧美做爰猛烈大尺度电-99久久夜色精品国产亚洲a-亚洲福利视频一区二区

.netcore項目中常用的類庫有哪些-創(chuàng)新互聯(lián)

這篇文章將為大家詳細(xì)講解有關(guān).net core項目中常用的類庫有哪些,小編覺得挺實(shí)用的,因此分享給大家做個參考,希望大家閱讀完這篇文章后可以有所收獲。

創(chuàng)新互聯(lián)公司專注為客戶提供全方位的互聯(lián)網(wǎng)綜合服務(wù),包含不限于做網(wǎng)站、網(wǎng)站制作、淅川網(wǎng)絡(luò)推廣、微信小程序、淅川網(wǎng)絡(luò)營銷、淅川企業(yè)策劃、淅川品牌公關(guān)、搜索引擎seo、人物專訪、企業(yè)宣傳片、企業(yè)代運(yùn)營等,從售前售中售后,我們都將竭誠為您服務(wù),您的肯定,是我們大的嘉獎;創(chuàng)新互聯(lián)公司為所有大學(xué)生創(chuàng)業(yè)者提供淅川建站搭建服務(wù),24小時服務(wù)熱線:18980820575,官方網(wǎng)址:www.chinadenli.net

漢字轉(zhuǎn)拼音


1、 HxfPinYin

.net core項目中常用的類庫有哪些

這是我自己根據(jù)網(wǎng)上大神提供的源碼,再。net core 框架下編譯出的類庫

主要提供漢字轉(zhuǎn)拼音的功能。

使用

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

.net core項目中常用的類庫有哪些

生成excel表格

string sFileName = $"{Guid.NewGuid()}.xlsx";
  FileInfo file = new FileInfo(sFileName);
  string[] title = { "貨品編號",
  "貨品名稱",
  "條碼",
  "規(guī)格",
  "基本單位",
  "當(dāng)前庫存",
  "庫存下限",
  "庫存上限"
  };
  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

.net core項目中常用的類庫有哪些

生成pdf

string tempFilePath = $"{Guid.NewGuid()}.pdf";
  string[] title = { "貨品編號",
  "貨品名稱",
  "條碼",
  "規(guī)格",
  "基本單位",
  "當(dāng)前庫存",
  "庫存下限",
  "庫存上限"
  };
  using (FileStream wfs = new FileStream(tempFilePath, FileMode.OpenOrCreate)) {
  //PageSize.A4.Rotate();當(dāng)需要把PDF紙張設(shè)置為橫向時
  Document docPDF = new Document(PageSize.A4,10, 10, 20,20);
  PdfWriter write = PdfWriter.GetInstance(docPDF, wfs);
  docPDF.Open();
  //在這里需要注意的是,itextsharp不支持中文字符,想要顯示中文字符的話需要自己設(shè)置字體 
  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();//關(guān)閉
  write.Close();
  wfs.Close();
  }

關(guān)于“.net core項目中常用的類庫有哪些”這篇文章就分享到這里了,希望以上內(nèi)容可以對大家有一定的幫助,使各位可以學(xué)到更多知識,如果覺得文章不錯,請把它分享出去讓更多的人看到。

當(dāng)前題目:.netcore項目中常用的類庫有哪些-創(chuàng)新互聯(lián)
URL網(wǎng)址:http://www.chinadenli.net/article20/degcco.html

成都網(wǎng)站建設(shè)公司_創(chuàng)新互聯(lián),為您提供網(wǎng)站營銷移動網(wǎng)站建設(shè)網(wǎng)頁設(shè)計公司微信公眾號面包屑導(dǎo)航響應(yīng)式網(wǎng)站

廣告

聲明:本網(wǎng)站發(fā)布的內(nèi)容(圖片、視頻和文字)以用戶投稿、用戶轉(zhuǎn)載內(nèi)容為主,如果涉及侵權(quán)請盡快告知,我們將會在第一時間刪除。文章觀點(diǎn)不代表本網(wǎng)站立場,如需處理請聯(lián)系客服。電話:028-86922220;郵箱:631063699@qq.com。內(nèi)容未經(jīng)允許不得轉(zhuǎn)載,或轉(zhuǎn)載時需注明來源: 創(chuàng)新互聯(lián)

成都定制網(wǎng)站網(wǎng)頁設(shè)計