标签: spreadsheet

如何在OPENXML电子表格单元格中插入换行符?

我目前使用这样的东西在单元格中插入内联字符串:

new Cell() 
{ 
    CellReference = "E2", 
    StyleIndex = (UInt32Value)4U, 
    DataType = CellValues.InlineString, 
    InlineString = new InlineString(new Text( "some text")) 
}
Run Code Online (Sandbox Code Playgroud)

但是\n插入换行符不起作用,我该怎么做呢?

谢谢


响应

new Cell(
         new CellValue("string \n string")
        ) 
    { 
        CellReference = "E2", 
        StyleIndex = (UInt32Value)4U, 
        DataType = CellValues.String         
    }
Run Code Online (Sandbox Code Playgroud)

c# spreadsheet line-breaks cell openxml

8
推荐指数
2
解决办法
1万
查看次数

PHP - 只读电子表格文件类型?

我正在使用一个简单的基于Web的PHP应用程序,它将表格作为电子表格输出

header("Content-Disposition: attachment; filename=" . $filename . ".xls");
header("Content-Type: application/vnd.ms-excel");

//inserts tab delimited text
Run Code Online (Sandbox Code Playgroud)

但我发现下载的电子表格打开为只读文件,必须在本地保存(在Windows上的Excel中),类型更改为XLS(来自HTML).有没有办法正确设置filetype的属性,以便进行简单的保存不需要更正文件类型?

文件是否以安全性方式下载为只读,这是不正常的?

此外,我不喜欢在Excel或OpenOffice(在Linux上)打开电子表格时创建的自动边框.我宁愿没有边框格式.文件中是否有一种方法可以指定没有添加的格式或者是否内置到这些应用程序中?

php formatting file-type spreadsheet readonly

8
推荐指数
2
解决办法
2730
查看次数

如何使用Perl修改现有的Excel工作簿?

有了Spreadsheet::WriteExcel,我可以创建一个新的工作簿,但是如果我想打开现有的书并修改某些列呢?我怎么做到这一点?

我可以解析工作表中的所有数据,Spreadsheet::ParseExcel然后使用,然后使用某些行/列中的新值将其写回Spreadsheet::WriteExcel.有没有一个模块已经结合了这两个?

主要是我只想打开一个.xls,覆盖某些行/列,并保存它.

perl xls spreadsheet

8
推荐指数
2
解决办法
3万
查看次数

如果在"Sheets","ThisWorkbook"和"Modules"中运行VBA代码,会有什么不同?

如果在"表格"("Sheet1","Sheet2"等),"ThisWorkbook"和"Modules"("Module1"等)中运行VBA代码,会有什么不同?

换句话说,在哪些情况下应该使用哪一个?

在此输入图像描述

excel vba spreadsheet excel-vba

8
推荐指数
2
解决办法
2万
查看次数

使用poi api从电子表格中读取时间值

我正在尝试从电子表格中读取日期列和时间列.我可以从工作表中退出日期列,但不能退出时间列.

例如,我的工作表将包含以下形式的行:

约会时间

11/2/2012 12:15:01

我有以下代码来获取日期列:

while(cellIterator.hasNext()) {
            HSSFCell cell = (HSSFCell)cellIterator.next();
            switch(cell.getCellType()){
                case HSSFCell.CELL_TYPE_NUMERIC:
                    HSSFCellStyle style = cell.getCellStyle();
                    if (HSSFDateUtil.isCellDateFormatted(cell))
                    {
                        d = (Date)getDateValue(cell);
                        SimpleDateFormat dateFormat = new SimpleDateFormat("MM/dd/yyyy");
                        System.out.println(dateFormat.format(d));

                    }


            }
        }  

protected static Object getDateValue(HSSFCell cellDate) 
{

         double numericDateValue = cellDate.getNumericCellValue();
         Date date = HSSFDateUtil.getJavaDate(numericDateValue);
         return date;

}
Run Code Online (Sandbox Code Playgroud)

如你所见,我用

HSSFDateUtil.isCellDateFormatted(细胞)

检查单元格中是否有日期值.我想知道我是否可以使用任何函数检查单元格是否具有时间值.

excel表来自外部来源.所以,我将无法对其格式进行任何修改.

现在,我得到日期列的正确日期值.但是,对于时间列,我得到了

1899年12月31日

作为所有行的结果

java excel datetime spreadsheet apache-poi

8
推荐指数
2
解决办法
1万
查看次数

上传OLE2签名的Roo电子表格无效

是的,所以我检查了Roo.伟大的宝石和所有,并有一个真正的基本应用程序,没有没有模型.基本的控制器,类和视图,我似乎无法上传电子表格,因为我收到OLE2 signature is invalid错误.我有以下基本设置

调节器

class SpreadsheetServiceController < ApplicationController

  def new
  end

  def create    
    parser = SpreadsheetTagService.new(params[:spreadsheet][:file])

    respond_to do |format|
      format.all {render :json => 'Done'}
    end
  end
end 
Run Code Online (Sandbox Code Playgroud)

SpreadsheetTagService

 class SpreadsheetTagService 
  include Roo

  def initialize(uploaded_file)
    @tmp_destination = "#{Rails.root}/tmp/tag-import.xls"
    @file_path = save_file_to_tmp(uploaded_file)
    @file = File.new(@file_path)
    read_file(@file)
  end 

  private 
    def save_file_to_tmp(uploaded_file)
      FileUtils.mv(uploaded_file.tempfile.path, @tmp_destination )
      @tmp_destination
    end

    def read_file(file)
      @spreadsheet = open_spreadsheet(file)
      @spreadsheet.each_with_pagename do |name,sheet|    
        Rails.logger.debug( sheet )
      end    
    end

    def open_spreadsheet(file)
      case File.extname(file.path)
        when ".csv" then Csv.new(file.path, nil, :ignore)
        when …
Run Code Online (Sandbox Code Playgroud)

ruby-on-rails spreadsheet ruby-on-rails-3 ruby-on-rails-3.1

8
推荐指数
2
解决办法
9130
查看次数

cfscript相当于cfspreadsheet action ="read"

相当于......

<cfspreadsheet action="read" src="#form.uploadedFile#" query="mycontent" >  
Run Code Online (Sandbox Code Playgroud)

在cfscript?

cfscript有spreadSheetRead(fileName) - 但结果是一个带有文件元数据的对象,即使我指定了工作表,它也只返回元数据而不是行列数据.

我需要遍历行...我该怎么做?

我试图避免退出我的脚本格式,并插入'cf'标签格式...任何帮助表示赞赏.

coldfusion spreadsheet cfspreadsheet

8
推荐指数
1
解决办法
1621
查看次数

可以使用Google Spreedsheet中的外部API调用吗?

我创建了一个包含五列的Google电子表格;

一旦用户填写前三列中的值,它就必须调用第三方API并填充第四和第五列中的值(响应).

是否可以在Google Spreadsheet中为API调用编写代码?是否可以在Google电子表格中调用并获取外部API的响应?

spreadsheet google-sheets google-spreadsheet-api

8
推荐指数
2
解决办法
9131
查看次数

Google表格过滤器使用IN子句

问题:在Google表格中,使用内置函数,如何编写过滤器以根据每行中不存在于另一个范围的有效值列表中的列来排除记录.

细节

我正在使用Google表格编写一份财务电子表格,其中我的所有费用和收入都输入到一张名为"交易"的表格中.我有一个名为常数的单独表格,其中列出了收入类别列表和费用类别列表.

以下是一些用于问题的示例数据:

常量

在此输入图像描述

交易

在此输入图像描述

我有一张名为ByMonth的工作表,我想在一个部分显示所有费用交易,并在一个单独的部分显示所有收入交易.目标:

在此输入图像描述

我需要在谷歌工作表功能基本上做这个SQL查询:

select date, category, amount from transactions 
where category not in (
    select * from expense_categories
)
Run Code Online (Sandbox Code Playgroud)

但我无法弄清楚如何让Google表格让我用他们的功能做一个IN概念.

这是一个单元函数表达式,我用它来根据日期字段过滤行:

=filter(Transactions!A2:C, 
        DATEVALUE(Transactions!A2:A) >= date(2015,4,1), 
        DATEVALUE(Transactions!A2:A) <= date(2015,4,30)
)
Run Code Online (Sandbox Code Playgroud)

我将向filter()函数添加第三个条件,并且第三个条件将以某种方式将每行数据的Category列与有效费用或收入类别列表进行比较并返回布尔值.

以下是我尝试过的其他一些事情,但无济于事,包括MATCH,ARRAYFORMULA等的一些变化:

=filter(Transactions!A2:C, row(Transactions!B2:B) = UNIQUE(Constants!A2:A))
=filter(Transactions!A2:C, Transactions!B2:B = UNIQUE(Constants!A2:A))
=filter(Transactions!A2:C, Transactions!B2:B = Constants!A2:A)
Run Code Online (Sandbox Code Playgroud)

有什么建议?

spreadsheet google-sheets google-apps-script

8
推荐指数
1
解决办法
7251
查看次数

例如按钮的 Google Sheets 脚本参数

是否可以在签名脚本上传递参数?

我有一个电子表格,并为每个电子表格制作了几个签名功能的按钮。

示例函数:

function foo(){
    return "bar";
}
Run Code Online (Sandbox Code Playgroud)

在单元格上调用此函数

=foo()
Run Code Online (Sandbox Code Playgroud)

返回我bar,将此函数签名到按钮

foo
Run Code Online (Sandbox Code Playgroud)

什么也没返回给我,但它当然有效。我的意思是脚本无法将字符串返回到图像(实际上是我的按钮)。无论如何...

带参数的示例函数:

=foo()
Run Code Online (Sandbox Code Playgroud)

在单元格中调用脚本

foo
Run Code Online (Sandbox Code Playgroud)

hello world按预期返回我

将此签名到我的按钮

function foo(bar){
    return bar;
}
Run Code Online (Sandbox Code Playgroud)

导致错误,因为按钮找不到脚本。他正在搜索一个函数名称foo('hello world'),但(...)与该函数无关。

那么签名脚本时如何传递参数呢?

目前我有 26 个函数(全部相同,只有 1 个参数变化)来解决这个问题。但是通过传递参数,我可以使用 2 个函数而不是 26 个函数来完成所有这些操作。

excel spreadsheet google-sheets google-sheets-api

8
推荐指数
1
解决办法
1万
查看次数