先上代码

 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. hdu 4123 树形DP+单调队列

    http://acm.hust.edu.cn/vjudge/problem/25790 这题基本同poj 3162 要注意mx,mx2,vx,vx2每次都要初始化 #include <iostr ...

  2. codevs 1213 解的个数

    1213 解的个数 时间限制: 1 s 空间限制: 128000 KB 题目等级 : 黄金 Gold       题目描述 Description 已知整数x,y满足如下面的条件: ax+by+c = ...

  3. Developer - 如何自我保证Node.js模块质量

    组里正在做SaaS产品,其中一些模块(Module)是Node.js实现,这里我们主要使用Node.js实现Web Server来提供服务. 在做SaaS项目之前,组里的开发模式是传统的Deverlo ...

  4. js&jquery:添加事件的三种方法和常用的一些事件

    一.添加事件的方法 1.EventTarget.addEventListener添加 获取事件目标元素,通过addEventListener函数添加 // Assuming myButton is a ...

  5. git github添加远程仓库出错 remote origin already exists

    在github上建立了仓库后,执行 git remote add origin https://github.com/zhangsan/sample.git时,提示 remote origin alr ...

  6. ring0 进程隐藏实现

    最近在学习内核编程,记录一下最近的学习笔记. 原理:将当前进程从eprocess结构的链表中删除 无法被! process 0 0 看见 #include "HideProcess.h&qu ...

  7. 快速提取邮箱地址(利用word或网站)

    在word中,CTRL+F,输入:[A-z,0-9]{1,}\@[A-z,0-9,\.]{1,} 点击“高级”,勾选“使用通配符”,点击“查找全部”: 复制.粘贴. 还可通过以下页面在线提取. htt ...

  8. C++指针、引用、const

    ; int *p = &a; //定义指针p指向变量a *p = ; //*p代表a的值 ; p = &b; //p指向变量b *p = ; //此时*p代表b的值 ] = {,,}; ...

  9. Codeforces - Educational Codeforces Round 5 - E. Sum of Remainder

    题目链接:http://codeforces.com/contest/616/problem/E 题目大意:给定整数n,m(1≤n,m≤1013), 求(n mod 1 + n mod 2 + ... ...

  10. UI5 Source code map机制的细节介绍

    在我的博客A debugging issue caused by source code mapping里我介绍了在我做SAP C4C开发时遇到的一个曾经困扰我很久的问题,最后结论是这个问题由于Jav ...