先上代码

 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. Javascript的map与forEach的区别

    原理: 高级浏览器支持forEach方法语法:forEach和map都支持2个参数:一个是回调函数(item,index,list)和上下文: forEach:用来遍历数组中的每一项:这个方法执行是没 ...

  2. 基于表单布局:分析过时的table结构与当下的div结构

    一些话在前面 最近做了百度前端学院一个小任务,其中涉及到表单布局的问题, 它要处理的布局问题:左边的标签要右对齐,右边的输入框.单选按钮等要实现左对齐. 从开始入门就被告知table布局已经过时了,当 ...

  3. css3实现iPhone滑动解锁

    该效果的主要实现思路是给文字添加渐变的背景,然后对背景进行裁剪,按文字裁剪(目前只有webkit内核浏览器支持该属性),最后给背景添加动画,即改变背景的位置,背景动画效果如下(GIF录制时有卡顿,代码 ...

  4. react-native 视频播放器(很不错哦)

    第一步: npm i -S react-native-af-video-player(安装前:先安装: react-native-video.react-native-keep-awake.react ...

  5. 缺陷=bug?

    Defect(缺陷):是指静态处在于软件工作产品(文档.代码)中的错误,也指软件运行时由于这些错误被激发导致的软件产品与其属性的偏离现象. Bug:Bug通常是软件缺陷(Defect)导致的一些软件故 ...

  6. SPFieldLookupValue

    //得到查阅项的值SPWeb web = site.OpenWeb();SPList list = web.Lists["DemoList"];SPListItem item = ...

  7. strdup和strndup函数

    首先说明一下:这两个函数不建议使用,原因是返回内存地址把释放权交给别的变量,容易忘记释放. 一.strdup函数 函数原型 头文件:#include <string.h> char *st ...

  8. helm深入学习

    Helm把Kubernetes资源(比如deployments.services或 ingress等) 打包到一个chart中,而chart被保存到chart仓库.通过chart仓库可用来存储和分享c ...

  9. Vim插件推荐

    看下文时要知道我的<leader>键就是\. ctags C程序阅读辅助工具.在看C/C++代码的时候经常需要在文件之间跳来跳去,这是很麻烦的事,ctags就是解决这种问题的.ctags是 ...

  10. MySQL入门很简单: 9 插入 更新与删除数据

    1. 插入数据:INSERT 1)为表的所有字段插入数据 第一种: 不指定具体的字段名 INSERT INTO 表名 VALUES(值1,值2,...,值n): 第二种:INSERT语句中列出所有字段 ...