先上代码

 using grproLib;
using System;
using System.Collections.Generic;
using System.Data;
using System.Data.SqlClient;
using System.IO;
using System.Net;
using System.Security.Cryptography;
using System.Text;
using System.Web.Script.Serialization; namespace shopeePrint
{
class Program
{
//static string ConnectionStr = "uid=gkweb_ticnL;pwd=gtIddQVVbSd89*@r%E;database=GBWMSDB;server=117.48.196.54,2859;Pooling=true;Min Pool Size=5;Max Pool Size=1000"; static void Main(string[] args)
{
string url = "https://sellercenter-api.jumia.com.ng/?";
//string Action = "FeedList";
string Action = "GetDocument";
string Format = "JSON";
string Timestamp = System.Web.HttpUtility.UrlEncode(DateTime.Now.AddDays(-).ToString("s") + "+0000", System.Text.Encoding.Default); ;
//string Timestamp = DateTime.Now.AddDays(-1).ToString("s") + "+0000";
string UserID = "jumia888999@gmail.com";
string Version = "1.0";
string Signature = "7c40abd44eeb21009edcb03f045360bdeec3a70d";
string DocumentType = "invoice";//'invoice', 'exportInvoice', 'shippingLabel', 'shippingParcel', 'carrierManifest', or "serialNumber".
string OrderItemIds = "[377847952]";
string str = string.Format("Action={0}&Format={1}&Timestamp={2}&UserID={3}&Version={4}&Signature={5}&DocumentType={6}&OrderItemIds={7}"
, Action, Format, Timestamp, UserID, Version, Signature,DocumentType, OrderItemIds);
//str = System.Web.HttpUtility.UrlEncode(str, System.Text.Encoding.Default);
string urlstr = url + str;
Console.WriteLine(urlstr);
Program.WriteLog(urlstr);
HttpWebRequest httpWebRequest = (HttpWebRequest)WebRequest.Create(urlstr);
string result = "";
try
{
HttpWebResponse httpResponse = (HttpWebResponse)httpWebRequest.GetResponse();
using (StreamReader streamReader = new StreamReader(httpResponse.GetResponseStream()))
{
result = streamReader.ReadToEnd();
Console.WriteLine(result);
Program.WriteLog(result);
}
}
catch (Exception err)
{
//msg = err.Message;
}
//string json = new JavaScriptSerializer().Serialize(param);
//string result = GetMessageResult(json, shoopurl, key, out msg);
//shopeeOrderList shooporders = new JavaScriptSerializer().Deserialize<shopeeOrderList>(result);
}
private static void WriteLog(string msg)
{ //当前程式目录创建Log目录
string path = AppDomain.CurrentDomain.BaseDirectory;
if (!Directory.Exists(path))
{
Directory.CreateDirectory(path);
}
string fileName = DateTime.Now.ToString("yyyy-MM-dd"); string filepath = path + fileName + ".txt"; Stream fileStream = null;
StreamWriter writeAdapter = null;
fileStream = File.Open(filepath, FileMode.Append, FileAccess.Write, FileShare.Write);
writeAdapter = new StreamWriter(fileStream, System.Text.Encoding.UTF8);
writeAdapter.WriteLine("***********" + DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss") + "************");
writeAdapter.WriteLine("Message::::" + msg);
writeAdapter.WriteLine("***********End*********************************************************");
writeAdapter.WriteLine(" ");
writeAdapter.Close();
} private static string GetMessageResult(string json , string url, string key, out string msg)
{
msg = "";
string input = string.Format("{0}|{1}", url.Replace(" ", ""), json.Replace(" ", ""));
HMACSHA256 hm256 = new HMACSHA256(ASCIIEncoding.ASCII.GetBytes(key));
byte[] hashBytes = hm256.ComputeHash(ASCIIEncoding.ASCII.GetBytes(input));
string authe = BitConverter.ToString(hashBytes).Replace("-", "").ToLower(); HttpWebRequest httpWebRequest = (HttpWebRequest)WebRequest.Create(url);
httpWebRequest.ContentType = "application/json";
byte[] bytes = System.Text.Encoding.ASCII.GetBytes(json);
httpWebRequest.ContentLength = bytes.Length;
httpWebRequest.Method = "POST";
httpWebRequest.Headers["Authorization"] = authe;
httpWebRequest.KeepAlive = false; Stream requestStream = httpWebRequest.GetRequestStream();
requestStream.Write(bytes, , bytes.Length);
requestStream.Close();
string result = "";
try
{
HttpWebResponse httpResponse = (HttpWebResponse)httpWebRequest.GetResponse();
using (StreamReader streamReader = new StreamReader(httpResponse.GetResponseStream()))
{
result = streamReader.ReadToEnd();
Program.WriteLog(result);
Console.WriteLine(result);
}
}
catch (Exception err)
{
msg = err.Message;
}
return result;
} } class FeedListParam
{
public string Action { get; set; }
public string Format { get; set; }
public string Timestamp { get; set; }
public string UserID { get; set; }
public string Version { get; set; }
public string Signature { get; set; }
public string CreatedAfter { get; set; }
public string CreatedBefore { get; set; }
public string Search { get; set; }
public string Filter { get; set; }
public string Limit { get; set; }
public string Offset { get; set; }
public string SkuSellerList { get; set; }
public string UpdatedAfter { get; set; }
public string UpdatedBefore { get; set; }
public string GlobalIdentifier { get; set; }
} }

项目引用NPOI

测试输出的Excel  显示条形码

设置边框

NPOI导出Excel,添加图片和设置格式,添加条形码的更多相关文章

  1. NPOI 导出excel带图片,可控大小

    using NPOI.HSSF.UserModel;using NPOI.HSSF.Util;using NPOI.DDF;using NPOI.SS.UserModel;using System.I ...

  2. NPOI导出EXCEL部分样式不起作用

    在使用NPOI导出excel的时候,设置cell样式,数据量多余6条之后,在后面几条数据没有样式(边框,对其,换行等). 原因是设置CellStyle的时候把CreateCellStyle放在循环列集 ...

  3. NPOI导出EXCEL 打印设置分页及打印标题

    在用NPOI导出EXCEL的时候设置分页,在网上有查到用sheet1.SetRowBreak(i)方法,但一直都没有起到作用.经过研究是要设置  sheet1.FitToPage = false; 而 ...

  4. [转]NPOI导出EXCEL 打印设置分页及打印标题

    本文转自:http://www.cnblogs.com/Gyoung/p/4483475.html 在用NPOI导出EXCEL的时候设置分页,在网上有查到用sheet1.SetRowBreak(i)方 ...

  5. NPOI导出excel(带图片)

    近期项目中用到Excel导出功能,之前都是用普通的office组件导出的方法,今天尝试用下NPOI,故作此文以备日后查阅. 1.NPOI官网http://npoi.codeplex.com/,下载最新 ...

  6. NPOI导出Excel(含有超过65335的处理情况)

    NPOI导出Excel的网上有很多,正好自己遇到就学习并总结了一下: 首先说明几点: 1.Excel2003及一下:后缀xls,单个sheet最大行数为65335 Excel2007 单个sheet ...

  7. NPOI导出EXCEL报_服务器无法在发送 HTTP 标头之后追加标头

    虽然发表了2篇关于NPOI导出EXCEL的文章,但是最近再次使用的时候,把以前的代码粘贴过来,居然报了一个错误: “服务器无法在发送 HTTP 标头之后追加标头” 后来也查询了很多其他同学的文章,都没 ...

  8. .NET NPOI导出Excel详解

    NPOI,顾名思义,就是POI的.NET版本.那POI又是什么呢?POI是一套用Java写成的库,能够帮助开发者在没有安装微软Office的情况下读写Office的文件. 支持的文件格式包括xls, ...

  9. 分享使用NPOI导出Excel树状结构的数据,如部门用户菜单权限

    大家都知道使用NPOI导出Excel格式数据 很简单,网上一搜,到处都有示例代码. 因为工作的关系,经常会有处理各种数据库数据的场景,其中处理Excel 数据导出,以备客户人员确认数据,场景很常见. ...

随机推荐

  1. 登录mysql数据库出现 : ERROR 1045 (28000): Access denied for user 'ODBC'@'localhost' (using password: NO) ER或者忘记密码

    1.     在安装mysql的文件目录中找到配置文件my.ini  ,然后右击用记事本打开 2.     打开后,搜索mysqld关键字 找到后,在mysqld下面添加skip-grant-tabl ...

  2. vue-样式问题

    问题: 今天在用vue开发单页面应用的时候,遇到一个问题,在A页面,直接刷新,页面的布局样式之类的是没有问题的,不过在B页面跳转到A页面,那么A页面有一些样式就不是预期的效果. 发现解决问题: 用调试 ...

  3. Miner3D Basic基础版

    ——强大的数据可视化软件 数据分析并不很复杂,Miner3D Basic基础版首先使用简单的方法,创造了强劲的图形驱动的数据处理模型,然后通过一个完整的视图为基本的交互环境,对基本数据进行分析,并通过 ...

  4. While, DoWhile in WorkFlow.

    On 03/03/2010, in 4.0, WF, by bcakiroglu While Activity In a While activity, the activity in the Bod ...

  5. java工程师要求

    高级JAVA研发工程师 8000-15000元/月 职位信息 职位描述 岗位要求:1.五年以上软件研发经验,两年以上软件架构设计经验:2.精通weblogic.jboss tomcat.websphe ...

  6. shell脚本学习(2)比较两个数字大小

    注意:shell中对比字符串只能使用==.<.>.!=.-z.-n.对比字符串时,末尾一定要加上x(或者a.b等)一个字符,因为if [ $1x == "ab"x ]时 ...

  7. Selenium入门12 鼠标和键盘事件

    1 鼠标 集成在webdriver.ActionChains.单击.双击.右击.拖放等等.   2 键盘 引入包from selenium.webdriver.common.keys import K ...

  8. SQL:数据库批量插入数据

    测试中有些功能要求有足够的数据进行测试,当输入字段较多时通过页面添加很慢.业务只关联单个数据库表可以通过数据库批量插入数据 批量插入数据示例: declare @i int--声明变量 --变量初始化 ...

  9. linux系统管理命令kata练习

    磁盘管理 #打印当前目录下,各个文件大小和目录的磁盘空间占用情况. #获取硬盘被占用了多少空间,目前还剩下多少空间等信息 df -lh #查看管理磁盘分区 fdisk -l #制作文件系统 mkfs ...

  10. 修改Windows下的Memcached下的服务端口

    在命令模式下,可以使用 memcached -p 12000 去指定端口,可服务安装后,却总是只有 -d runservice 的参数. 通过修改注册表来达到这个修改端口的目的. 在 HKEY_LOC ...