先上代码

 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. laravel安装时openssl_encrypt() 的问题?Call to undefined function openssl_decrypt()

    解决方案: 如果通过上面的步骤还是不能解决参考如下: 1.从php安装根目录中拷贝 libeay32.dll 和 ssleay32.dll 然后 覆盖掉apache/bin 下的对应文件(注意需要将h ...

  2. Javascript基础--函数(Function对象)

    1.函数是一段可执行的代码,函数可多次调用,模块化管理. 2.使用function语句,function funName([arg1][,arg2]....[,argn]){代码块}.所有版本可用,一 ...

  3. SonarQube代码质量管理平台介绍与搭建

    前 言 1.SonarQube的介绍 SonarQube是一个管理代码质量的开放平台. 可以从七个维度检测代码质量(为什么要用SonarQube): (1) 复杂度分布(complexity):代码复 ...

  4. Request processing failed; nested exception is org.apache.ibatis.binding.BindingException: Invalid b

    Request processing failed; nested exception is org.apache.ibatis.binding.BindingException: Invalid b ...

  5. 【CCPC-Wannafly Winter Camp Day4 (Div1) F】小小马(分类讨论)

    点此看题面 大致题意: 给你一张\(n*m\)的棋盘,问你一匹马在两个点中是否存在一条经过黑白格子数目相等的路径. 简化题目 首先,我们来简化一下题目. 考虑到马每次走的时候,所经过的格子的颜色必然发 ...

  6. 【洛谷P3390】矩阵快速幂

    矩阵快速幂 题目描述 矩阵乘法: A[n*m]*B[m*k]=C[n*k]; C[i][j]=sum(A[i][1~n]+B[1~n][j]) 为了便于赋值和定义,我们定义一个结构体储存矩阵: str ...

  7. 【洛谷P1323】删数问题

    删数问题 题目链接 首先找出最小的k个数:用堆每次取出最小的元素p,将p*2+1和p*4+5压入堆. 贪心求最大数:从前往后找第一个data[j+1]>data[j],删除data[j].(链表 ...

  8. C# 使用布尔操作符

    布尔操作符(Boolean operator)是求值结果要么为true,要么为false的一种操作符.C#提供了几个非常有用的布尔操作符,其中最简单的是NOT(求反)操作符,它使用感叹号(!)来表示. ...

  9. 第34-1题:LeetCode112. Path Sum I

    题目 给定一个二叉树和一个目标和,判断该树中是否存在根节点到叶子节点的路径,这条路径上所有节点值相加等于目标和. 说明: 叶子节点是指没有子节点的节点. 示例:  给定如下二叉树,以及目标和 sum ...

  10. 【ACM之行】◇第一站◇ 2018HDU多校赛总结

    ◇第一站◇ 2018HDU多校赛 十场多校赛下来,也算是给一个初中生开了眼界……看着清华一次次AK(默默立下flag),看着自己被同校的高中生完虐,一个蒟蒻只能给dalao们垫脚