相关疑难解决方法(0)

使用OpenXml sdk 2.0创建Excel文档

我使用OpenXml SDK 2.0创建了一个Excel文档,现在我必须设置它的样式,但我不能.

我不知道如何绘制背景颜色或更改不同单元格中的字体大小.

我创建单元格的代码是:

private static Cell CreateTextCell(string header, string text, UInt32Value index)
{
    Cell c = new Cell();
    c.DataType = CellValues.InlineString;
    c.CellReference = header + index;
    InlineString inlineString = new InlineString();
    DocumentFormat.OpenXml.Spreadsheet.Text t = new DocumentFormat.OpenXml.Spreadsheet.Text();
    t.Text = text;
    inlineString.AppendChild(t);
    c.AppendChild(inlineString);
    return c;
} 
Run Code Online (Sandbox Code Playgroud)

c# excel openxml spreadsheetml

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

在jquery或jqGrid中导出到excel

我有一个jqGrid,我从JSON格式的服务器(java)一次获取数据.我希望将jqGrid中的数据导出为Excel格式.

直到现在我看到这个页面在IE中给我一个错误'o.url is null or not an object' grid.import.js

另外我看到这个演示在导出按钮的工具提示上,Export To Excel但是保存的文件是xml格式.

所以我想任何可以使用javascript或jquery插件或使用jqgrid的内置功能将我的JSON字符串转换为excel的建议.

我的jqGrid

在此输入图像描述

我的jqGrid代码

grid = jQuery("#list2");
                grid.jqGrid({
                    datastr : comparePatchData,
                    datatype: 'jsonstring',
                    colNames:['Name',starheader, header1, header2],
                    colModel:[
                        {name:'elementName',index:'elementName', width:90},
                        {name:'isPrasentinXml1',index:'isPrasentinXml1', width:100, align:'center', formatter: patchPresent},
                        {name:'isPrasentinXml2',index:'isPrasentinXml2', width:100, align:'center', formatter: patchPresent},
                        {name:'isPrasentinXml3',index:'isPrasentinXml3', width:100, align:'center', formatter: patchPresent}
                    ],
                    pager : '#gridpager2',
                    rowNum:12,
                    scrollOffset:0,
                    height: 320,
                    autowidth:true,
                    viewrecords: true,
                    gridview: true,
                    loadonce:true,
                    jsonReader: {
                        repeatitems: false,
                        page: function() { return 1; },
                        root: "response" …
Run Code Online (Sandbox Code Playgroud)

javascript excel jquery jquery-plugins jqgrid

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

jqgrid + EF + MVC:如何在excel中导出?你建议哪种方法?

我正在使用带有EF 4 + MVC3的jqgrid(标准).我想实现excel导出.你建议我使用哪种方法?

为了生成excel,我想使用Stephen Walther博士的这个库,它有三种类型的输出,并允许定义标题.如果您发现它对我的目的有效,请告诉我.

我问这个问题是因为我还在接近实现excel导出,我发现了几种技术.有人建议进行csv导出,其他人表示它应该返回JSON输出,我不清楚这个功能是否存在于jqgrid的免费版本中.无论如何,我想将数据传递给Walther的对象.

关于jqgrid代码,我在Oleg 找到了这个有趣的答案,但我不明白是否可以应用于我的需求.

不幸的是,到目前为止我只发现了使用EF MVC进行excel导出的部分解决方案,但没有解决方案或完整示例......

关于MVC逻辑,我将实现和开发这个代码,正如@Tommy所建议的那样.

如果问题可能很愚蠢,请抱歉,我只是一个(爱好者)初学者.

感谢您的宝贵帮助! 最好的祝福

asp.net-mvc excel export jqgrid

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