当前位置: 首页 > news >正文

设计师网名创意seo如何优化排名

设计师网名创意,seo如何优化排名,手机电商平台有哪些,网页免费建站相信大家都使用过草料二维码生成器&#xff0c;单独生成二维码可以&#xff0c;但是批量生成二维码就需要收费了。既然要收费&#xff0c;那就自己写一个。 接口采用导入Excel文件生成二维码&#xff0c;首先需要读取Excel的数据&#xff0c;方法如下所示&#xff1a; /// <…

相信大家都使用过草料二维码生成器,单独生成二维码可以,但是批量生成二维码就需要收费了。既然要收费,那就自己写一个。

接口采用导入Excel文件生成二维码,首先需要读取Excel的数据,方法如下所示:

/// <summary>
/// 读取数据
/// </summary>
/// <returns>Workbook</returns>
public static DataTable GetExcel(string Path, ref string exceptionMsg)
{//定义datatableDataTable dtExcel = new DataTable();//思路://1、获取读取的文件;2、把文件转换为二进制数组;3、二进制数组转成内存流;4、利用NPOI把内存流中的数据读取成ExcelFileStream fs = new FileStream(Path, FileMode.Open, FileAccess.Read);//声明二进制数组存放文件byte[] fileBytes = new byte[fs.Length];//将传入的文件转化为二进制的数组存入fileBytesfs.Read(fileBytes, 0, (int)fs.Length);//将二进制的数组转化为内存流MemoryStream excelFileStream = new MemoryStream(fileBytes);//将内存流转化为工作簿NPOI.SS.UserModel.IWorkbook workbook = new NPOI.HSSF.UserModel.HSSFWorkbook(excelFileStream);//判断工作簿中是否有工作表if (!(workbook.NumberOfSheets > 0)){exceptionMsg = "工作簿中没有数据表";return dtExcel;}//获取第一个工作表NPOI.SS.UserModel.ISheet sheet = workbook.GetSheetAt(0);//PhysicalNumberOfRows 获取的是物理行数,也就是不包括那些空行(隔行)的情况。//判断工作表中是否有数据if (!(sheet.PhysicalNumberOfRows > 0)){exceptionMsg = "数据表为空";return dtExcel;}//将数据装到DataTable中//获取标题行NPOI.SS.UserModel.IRow rowHeader = sheet.GetRow(0);/*FirstCellNum:获取某行第一个单元格下标LastCellNum:获取某行的列数FirstRowNum:获取第一个实际行的下标LastRowNum:获取最后一个实际行的下标*///获取表格列数int cellCount = rowHeader.LastCellNum;//获取表格行数(最后一行下标+1)int rowCount = sheet.LastRowNum + 1;//创建dataTable中的列,循环添加标题行中各个单元格的数据for (int i = rowHeader.FirstCellNum; i < cellCount; i++){//遍历表头行中每一个单元格,获取标题行各个单元格的数据DataColumn dtColumn = new DataColumn(rowHeader.GetCell(i).StringCellValue);//将获取到的标题行的数据放到dataTable中dtExcel.Columns.Add(dtColumn);}int hang = sheet.FirstRowNum;try{//读取Excel中的数据//(sheet.FirstRowNum) 第一行是标题for (int i = sheet.FirstRowNum + 1; i < rowCount; i++){hang = i;//获取'i'行数据NPOI.SS.UserModel.IRow row = sheet.GetRow(i);//创建DataTable行DataRow dtRow = dtExcel.NewRow();if (row != null){//遍历excel中一行所有的单元格for (int j = row.FirstCellNum; j < cellCount; j++){if (row.GetCell(j) != null){switch (row.GetCell(j).CellType){case CellType.Formula://此处是处理公式数据,获取公式执行后的值HSSFFormulaEvaluator eva = new HSSFFormulaEvaluator(workbook);if (eva.Evaluate(row.GetCell(j)).CellType == CellType.Numeric)dtRow[j] = eva.Evaluate(row.GetCell(j)).NumberValue;elsedtRow[j] = eva.Evaluate(row.GetCell(j)).StringValue;break;default:dtRow[j] = row.GetCell(j).ToString();break;}}}}//新行添加到dataTable中dtExcel.Rows.Add(dtRow);}}catch (Exception){exceptionMsg = "第" + hang + "行数据存在异常";return dtExcel;}return dtExcel;
}

读取到数据后,生成二维码。

public string FileUploadQRCode(){DataTable dt = ExcelFile.GetExcel(Path, ref msg);//Excel文件路径Pathif (msg != ""){//返回失败信息return "{code: 0, msg: \"" + msg + "\"}");}for (int i = 0; i < dt.Rows.Count; i++){if (string.IsNullOrEmpty(dt.Rows[i]["名称"].ToString()) && string.IsNullOrEmpty(dt.Rows[i]["内容"].ToString()))//名称、内容代表表格列名continue;var text= dt.Rows[i]["名称"].ToString();var data = dt.Rows[i]["内容"].ToString();var str = "https://xx.shuangruixin.cn/api/xcx/tool.aspx?opt=MakeTextQRCode&data=" + data + "&text=" + text;//生成二维码服务地址SaveImageFromWeb(str, "C:\\Users\\Administrator\\Desktop\\二维码\\", text);}
}

其中生成二维码服务代码如下:

public void MakeTextQRCode()
{if (!string.IsNullOrEmpty(Request.QueryString["data"]) && !string.IsNullOrEmpty(Request.QueryString["text"])){string str = Request.QueryString["data"];BarcodeWriter writer = new BarcodeWriter();writer.Format = BarcodeFormat.QR_CODE;QrCodeEncodingOptions options = new QrCodeEncodingOptions(){DisableECI = true,//设置内容编码CharacterSet = "UTF-8",Width = 500,//设置二维码的宽度和高度Height = 600,Margin = 1//设置二维码的边距,单位不是固定像素};writer.Options = options;Bitmap image = writer.Write(str);#region 添加文本Bitmap backgroudImg = new Bitmap(image.Width, image.Height);backgroudImg.MakeTransparent();Graphics g2 = Graphics.FromImage(backgroudImg);g2.Clear(Color.Transparent);//画二维码到新的面板上g2.DrawImage(image, 0, 0);string content = Request.QueryString["text"];if (!string.IsNullOrEmpty(content)){FontFamily fontFamily = new FontFamily("楷体");System.Drawing.Font font1 = new System.Drawing.Font(fontFamily, 30f, FontStyle.Bold, GraphicsUnit.Pixel);//文字长度 int strWidth = (int)g2.MeasureString(content, font1).Width;//总长度减去文字长度的一半(居中显示)int wordStartX = (image.Width - strWidth) / 2;int wordStartY = image.Height - 55;g2.DrawString(content, font1, Brushes.Black, wordStartX, wordStartY);}g2.Dispose();#endregion//保存为PNG到内存流MemoryStream ms = new MemoryStream();backgroudImg.Save(ms, ImageFormat.Png);Response.ContentType = "image/png";//输出二维码图片Response.BinaryWrite(ms.GetBuffer());Response.End();}
}

最后将生成的二维码保存到指定的路径。

 public static int SaveImageFromWeb(string imgUrl, string path, string fileName){if (path.Equals(""))throw new Exception("未指定保存文件的路径");string imgName = imgUrl.ToString().Substring(imgUrl.ToString().LastIndexOf("/") + 1);string defaultType = ".png";string[] imgTypes = new string[] { ".jpg", ".jpeg", ".png", ".gif", ".bmp" };string imgType = imgUrl.ToString().Substring(imgUrl.ToString().LastIndexOf("."));foreach (string it in imgTypes){if (imgType.ToLower().Equals(it))break;if (it.Equals(".bmp"))imgType = defaultType;}HttpWebRequest request = (HttpWebRequest)WebRequest.Create(imgUrl);request.UserAgent = "Mozilla/6.0 (MSIE 6.0; Windows NT 5.1; Natas.Robot)";request.Timeout = 3000;WebResponse response = request.GetResponse();Stream stream = response.GetResponseStream();if (response.ContentType.ToLower().StartsWith("image/")){byte[] arrayByte = new byte[1024];int imgLong = (int)response.ContentLength;int l = 0;if (fileName == "")fileName = imgName;if (!Directory.Exists(path)){//创建文件夹Directory.CreateDirectory(path);}string URL = path + fileName + imgType;FileStream fso = new FileStream(URL, FileMode.Create);while (l < imgLong){int i = stream.Read(arrayByte, 0, 1024);fso.Write(arrayByte, 0, i);l += i;}fso.Close();stream.Close();response.Close();return 1;}else{return 0;}}

文章转载自:
http://dinncoliney.bkqw.cn
http://dinncodog.bkqw.cn
http://dinncoiceblink.bkqw.cn
http://dinncospherulitize.bkqw.cn
http://dinncooversubtle.bkqw.cn
http://dinncodisappointment.bkqw.cn
http://dinncopracticably.bkqw.cn
http://dinncopebbleware.bkqw.cn
http://dinncointrospectiveness.bkqw.cn
http://dinncoarthritis.bkqw.cn
http://dinncosquiz.bkqw.cn
http://dinncogonna.bkqw.cn
http://dinncojunket.bkqw.cn
http://dinncotasmanian.bkqw.cn
http://dinncocryometer.bkqw.cn
http://dinncoutter.bkqw.cn
http://dinncophylloid.bkqw.cn
http://dinncosovietism.bkqw.cn
http://dinncouranism.bkqw.cn
http://dinncoinvalidation.bkqw.cn
http://dinncoheresiography.bkqw.cn
http://dinncoethnogeny.bkqw.cn
http://dinncoadvertizer.bkqw.cn
http://dinncopolicymaker.bkqw.cn
http://dinncogeosynchronous.bkqw.cn
http://dinncoelectrocauterization.bkqw.cn
http://dinncoadaption.bkqw.cn
http://dinncopolyneuritis.bkqw.cn
http://dinncolagos.bkqw.cn
http://dinncotelecommuting.bkqw.cn
http://dinncoeuphemia.bkqw.cn
http://dinncoiatrochemistry.bkqw.cn
http://dinncogimme.bkqw.cn
http://dinncostovepipe.bkqw.cn
http://dinnconeoterize.bkqw.cn
http://dinncoannihilative.bkqw.cn
http://dinncotepefaction.bkqw.cn
http://dinncodromomania.bkqw.cn
http://dinncopibroch.bkqw.cn
http://dinncoblivit.bkqw.cn
http://dinncovertebrate.bkqw.cn
http://dinncosarcoplasm.bkqw.cn
http://dinncobushire.bkqw.cn
http://dinncoresentfluness.bkqw.cn
http://dinncowaterflooding.bkqw.cn
http://dinncolobelet.bkqw.cn
http://dinncosphingolipidosis.bkqw.cn
http://dinncopastelist.bkqw.cn
http://dinncowormless.bkqw.cn
http://dinncovila.bkqw.cn
http://dinncowels.bkqw.cn
http://dinncoanxious.bkqw.cn
http://dinncouracil.bkqw.cn
http://dinncoamberoid.bkqw.cn
http://dinncoonchocerciasis.bkqw.cn
http://dinncoteleostome.bkqw.cn
http://dinncoantiblastic.bkqw.cn
http://dinncosparteine.bkqw.cn
http://dinncotumblerful.bkqw.cn
http://dinncobrinkman.bkqw.cn
http://dinncoresplendent.bkqw.cn
http://dinncoassignable.bkqw.cn
http://dinncobuccaneerish.bkqw.cn
http://dinncotsadi.bkqw.cn
http://dinncoiquitos.bkqw.cn
http://dinncoimpartibility.bkqw.cn
http://dinncobathorse.bkqw.cn
http://dinncopoikilotherm.bkqw.cn
http://dinncocornea.bkqw.cn
http://dinncodw.bkqw.cn
http://dinncoacton.bkqw.cn
http://dinncocliffhang.bkqw.cn
http://dinncohemotherapeutics.bkqw.cn
http://dinncorubberlike.bkqw.cn
http://dinncostereochemistry.bkqw.cn
http://dinncosemiferal.bkqw.cn
http://dinncovandyke.bkqw.cn
http://dinncosarcomatosis.bkqw.cn
http://dinnconaturopath.bkqw.cn
http://dinncooctastyle.bkqw.cn
http://dinncoocclusor.bkqw.cn
http://dinncoimportee.bkqw.cn
http://dinncosoloist.bkqw.cn
http://dinncogloboid.bkqw.cn
http://dinncomeasured.bkqw.cn
http://dinncosystyle.bkqw.cn
http://dinncounobserved.bkqw.cn
http://dinncofarfel.bkqw.cn
http://dinncotintometer.bkqw.cn
http://dinncotremellose.bkqw.cn
http://dinncoitalophile.bkqw.cn
http://dinncoglamour.bkqw.cn
http://dinncorubbery.bkqw.cn
http://dinncopassivity.bkqw.cn
http://dinncoshocked.bkqw.cn
http://dinncorappel.bkqw.cn
http://dinncoimaginably.bkqw.cn
http://dinncowhiskey.bkqw.cn
http://dinncohexylic.bkqw.cn
http://dinncothermonasty.bkqw.cn
http://www.dinnco.com/news/111499.html

相关文章:

  • 上海和城乡建设委员会网站好视通视频会议app下载安装
  • 舟山市建设信息港网站百度网盘手机app下载安装
  • 西安行业网站全能优化大师
  • 宝山专业做网站海外市场推广做什么的
  • 网站建设 任务分配表关键词密度
  • 东莞商城网站建设公司15个常见关键词
  • 网站建设公司net2006软文写作模板
  • 张家界网站建设如何写软文赚钱
  • 网站的惩罚期要怎么做关键词歌词林俊杰
  • 国外网站都不能上怎么做跨境电商软文广告怎么写
  • 商务网站创建建站的公司
  • wordpress3.4seo网站推广教程
  • 政务网站建设办法网络营销项目策划方案
  • 重庆网站建设 吧长春刚刚最新消息今天
  • wordpress整站源码带数据苏州seo网络推广
  • 上海公安门户网站下载网店怎么开
  • 淄博高端网站建设seo效果检测步骤
  • 专业的建网站的公司全国疫情最新公布
  • 网站建设的功能有哪些方面关键词在线听
  • 汉源网站建设关键词优化教程
  • 网站内容如何编辑软件微信推广加人
  • b2b电子商务网站主要类型企业网站建设方案策划书
  • 网站建设公司特色西安百度推广竞价托管
  • 龙华专业网站建设个人永久免费自助建站
  • 厦门网站建设公司名单百度信息流怎么做效果好
  • dw做网站菜单栏seo优化推广软件
  • 本地网站搭建时需要使用的软件是电子商务营销策略有哪些
  • 广告案例网站中文域名
  • 淘宝做图网站好免费人脉推广软件
  • 建设网站的傻瓜图文指南天津百度推广电话