嘿伙计们,我有一个由Gnuplot生成的png文件,我需要使用XLWT将其放入excel文档中.
XLWT无法将PNG导入到文档中,只能导入BMP,因此我需要首先转换PNG.我用PIL这个.
这是相关的代码:
im = Image.open('%s' % os.path.join(os.getcwd(), s + '.png'))
im.save('%s.bmp' % s)
Run Code Online (Sandbox Code Playgroud)
但XLWT给了我这个错误:
Exception: bitmap isn't a 24bit true color bitmap.
Run Code Online (Sandbox Code Playgroud)
这是XLWT代码的样子:
self.chart.insert_bitmap(path, 2, 2)
Run Code Online (Sandbox Code Playgroud)
我知道这两个图像都很好用,它们都可以通过windows打开.我还尝试在创建BMP后添加2秒暂停(以弥补写入时间),但它仍然失败.
如何使用PIL制作24位真彩色位图?
我遇到了ASP.NET的会话变量和Web服务代理对象的问题.我可以访问我在实际.asmx文件中创建的任何数据,但添加数据"通过"会话变量导致绝对没有任何事情发生.
我的目标很简单,我想创建一个"几乎购物车".客户在此文本框中输入标题,然后将其发送到Web服务.在主页中调用Web服务,它会抓取一个数组列表,其中包含客户请求的"标题".
数据在下拉框中可见,标签存储所有项目的总成本(我现在不担心成本).
问题是,无论何时我调用Web服务方法,绝对没有任何反应.
有问题的守则:
Basket.asmx
public class basket : System.Web.Services.WebService {
ArrayList reservations = new ArrayList();
double total = 0;
public basket()
{
reservations.Add("Extreme Test Data");
reservations.Add("Moar Test Data");
}
[WebMethod]
public string[] getReservations()
{
//This may be part of the issue, still not sure.
return (string[])reservations.ToArray(typeof( string));
}
[WebMethod]
public string toString()
{
return reservations[reservations.Count - 1].ToString();
}
[WebMethod]
public double getTotal()
{
return total;
}
[WebMethod]
public void addCost(double price)
{
total = total + price;
} …Run Code Online (Sandbox Code Playgroud)