jjzjj

python xlutils : formatting_info=True not yet implemented

coder 2023-08-13 原文

我有简单的代码可以使用 xlutils、xlrd、xlwt(从 python-excel.org 下载的新库)复制文件而不丢失格式。我收到如下错误:

from xlwt.Workbook import *
from xlwt.Style import *
from xlrd import open_workbook
from xlutils.copy import copy
import xlrd

style = XFStyle()
rb = open_workbook('file_master.xlsx', formatting_info=True)
wb = copy(rb.get_sheet(0))

new_book = Workbook()
w_sheet = wb.get_sheet(0)
w_sheet.write(6,6)

wb.save('new_file_master.xls')

错误:

 raise NotImplementedError("formatting_info=True not yet implemented")
NotImplementedError: formatting_info=True not yet implemented

能否请您帮我解决这个问题,或者让它发挥作用?

最佳答案

根据 this thread旗帜

formatting_info=True

仅适用于 xls 文件,但不适用于 xlsx(版本 xlrd-0.8.0)。

作为解决方法,您可以使用 Excel 或 OpenOffice 将工作簿转换为 xls。

似乎可以使用 Unoconv 从 xlsx 到 xls 的命令行转换在 Linux、Windows 和 MacOSX 上。

关于 python xlutils : formatting_info=True not yet implemented,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/13892307/

有关python xlutils : formatting_info=True not yet implemented的更多相关文章

  1. ruby-on-rails - 如何从 format.xml 中删除 <hash></hash> - 2

    我有一个对象has_many应呈现为xml的子对象。这不是问题。我的问题是我创建了一个Hash包含此数据,就像解析器需要它一样。但是rails自动将整个文件包含在.........我需要摆脱type="array"和我该如何处理?我没有在文档中找到任何内容。 最佳答案 我遇到了同样的问题;这是我的XML:我在用这个:entries.to_xml将散列数据转换为XML,但这会将条目的数据包装到中所以我修改了:entries.to_xml(root:"Contacts")但这仍然将转换后的XML包装在“联系人”中,将我的XML代码修改为

  2. ruby - 我怎样才能只写一次 "Text"并同时检查 path_info 是否包含 'A' ? - 2

    -if!request.path_info.include?'A'%{:id=>'A'}"Text"-else"Text"“文本”写了两次。我怎样才能只写一次并同时检查path_info是否包含“A”? 最佳答案 有两种方法可以做到这一点。使用部分,或使用content_forblock:如果“文本”较长,或者是一个重要的子树,您可以将其提取到一个部分。这会使您的代码变干一点。在给出的示例中,这似乎有点矫枉过正。在这种情况下更好的方法是使用content_forblock,如下所示:-if!request.path_info.inc

  3. ruby - 如何将字符串格式的毫秒数转换为 HH :MM:SS format in Ruby in under 3 lines of code? - 2

    @scores_raw.eachdo|score_raw|#belowiscodeiftimewasbeingsentinmillisecondshh=((score_raw.score.to_i)/100)/3600mm=(hh-hh.to_i)*60ss=(mm-mm.to_i)*60crumbs=[hh,mm,ss]sum=crumbs.first.to_i*3600+crumbs[1].to_i*60+crumbs.last.to_i@scoressum,:hms=>hh.round.to_s+":"+mm.round.to_s+":"+ss.round.to_s}@score

  4. ruby - Sinatra 应用程序中的错误 "undefined local variable or method ` logger '"when using ` logger.info` - 2

    我有以下Sinatra1.2.1应用程序代码:#app.rbrequire'sinatra'get'/'dologger.info"COUCOU"'Helloworld!'end并使用ruby-rubygemsapp.rb启动服务器。当我转到http://localhost:4567时出现错误:NameErrorat/undefinedlocalvariableormethod`logger'for#file:app.rblocation:blockinline:4我是否需要添加或配置一些东西才能在Sinatra中启用日志记录?阅读SinatraREADME和文档,似乎默认情况下为Si

  5. ruby-on-rails - 如何匹配YYYY-MM-DDThh :mm:ssTZD timezone format in ruby - 2

    我想检查在ruby​​中输入的日期的iso8601格式,比如start_date="2011/05/05"应该匹配2011-05-05T00格式:00:00-04:00并相应地返回错误。我们应该在这里使用正则表达式还是为此提供任何方法? 最佳答案 听起来像你想要的Time.iso8601:require'time'iso=Time.iso8601(start_date)参见thisblogpost获取更多信息。编辑:这是一个简短但完整的有效测试程序:require'time'text="2011-05-05T00:00:00-04:

  6. ruby - 应该 validate_format_of 。 not_with 在框架中有问题(或者在我的理解中) - 2

    我将以下代码放入RSpec测试中:it{shouldvalidate_format_of(:email).not_with('test@test')}并设置实际的类:validates:email,:presence=>true,:format=>/\b[A-Z0-9._%-]+@(?:[A-Z0-9-]+\.)+[A-Z]{2,4}\b/i当我运行测试时,我得到:失败:1)用户失败/错误:它{应该validate_format_of(:email).not_with('test@test')}当电子邮件设置为“test@test”时,预期错误包括“can'tbeblank”,得到错误

  7. ruby-on-rails - PinsController#index : declare the formats your controller responds to in the class level 中的运行时错误 - 2

    在我的Rails应用程序上工作时,我在终端中使用以下命令创建了一个“Pins”脚手架:railsgeneratescaffoldPinsdescription:string--skip-stylesheets这会在我的应用程序中创建脚手架,然后我运行:rakedb:migrate一切顺利。我没有更改任何生成的页面,但是当我最终尝试访问localhost:3000上的新脚手架时,出现以下错误:RuntimeErrorinPinsController#indexInordertouserespond_with,firstyouneedtodeclaretheformatsyourcontr

  8. ruby-on-rails - Sorcery Gem - 外部提供商的自定义 user_info_mapping - 2

    我正在使用SorceryAuthenticationGem的0.7.7版通过NoamB在我的Rails3.2应用程序上我正在寻找一种可能性,如何连接一种为特定外部登录提供商(例如facebook、twitter)执行用户信息映射的方法。例如,我想将提供的语言环境更改为我在数据库中使用的格式,或者我想从Twitter下载用户头像作为匹配过程的一部分。默认情况下,只有通过sorcery.rb文件才能通过这种方式:config.facebook.user_info_mapping={:email=>"email",:first_name=>"first_name",:last_name=>"

  9. ruby-on-rails - rails : Human-friendly date format for text_field - 2

    我有一个存储为日期时间值的birth_date字段。默认的railsformhelpers吐出一种不太友好的格式,例如“2008-06-1022:33:19.000000”。下面是Vanillarails方式。"20"%>我怎样才能简单地应用一种格式?我尝试了各种方法,例如strftime应该可以,我想。但是当我尝试以下操作时,出现错误undefinedmethod'strftime'fornil:NilClassf.object.birth_date.strftime('%m/%d/%Y'),:size=>"20"%>根据其他一些问题/答案,我尝试了以下方法。它适用于非空值,但它是丑

  10. ruby-on-rails - 我可以将 rspec --format 文档设置为默认值吗? - 2

    PertheRspecdocumentation,默认情况下,当您运行rspec时,您会获得进度格式化程序(看起来像这样:“.....”)。还有另一个格式化选项rspec--formatdocumentation一个一个地检查每个测试。我的问题:如何在默认情况下启用--formatdocumentation而不必每次都在命令行中键入它? 最佳答案 选项1将它添加到.rspec文件(或在项目的根目录中创建一个)-添加到它的选项将应用于当前项目中的每个测试运行:#.rspec--color--formatdocumentation选项2

随机推荐