- android - 多次调用 OnPrimaryClipChangedListener
- android - 无法更新 RecyclerView 中的 TextView 字段
- android.database.CursorIndexOutOfBoundsException : Index 0 requested, 光标大小为 0
- android - 使用 AppCompat 时,我们是否需要明确指定其 UI 组件(Spinner、EditText)颜色
我在向现有表格中添加行时遇到了问题,在我的应用程序中,我正在处理 word 文件。在我的模板(word 文件)中已经有一个 8 行的表格,不包括标题(你可以在图片中看到),当在我的应用程序中构建一个新的 word 文件时,有时我想在表格中添加更多行,因为也许我有更多数据要插入(来自 dataGridView 的数据)。就像在下面的代码中一样,我根据我的 datagridview 中有多少行来添加行,问这个:
using (DocX document = DocX.Load(filename))
{
int k = 0;
Table t = document.Tables[0];
// Specify some properties for this Table.
t.Alignment = Alignment.right;
if (howManyRows > t.RowCount)
{
int x = howManyRows - t.RowCount;
for (int i = 0; i < x; i++)
{
Row row = t.InsertRow();
}
}
我也尝试过:t.InsertRow();
然后我从我的 dataGridView 将我的表填充到 word 文件中,然后我得到一个未处理的异常 - 索引超出范围,这没有意义,因为如果我不添加行,只是用相同的行填充表使用相同代码的数字,我没有发现任何异常,并且表格工作正常,这是我从 dataGridView 的字符串列表中填充的代码:
for (int i = 1; i <=howManyRows; i++)
{
for (int j = 4; j >= 0; j--)
{
t.Rows[i].Cells[j].Paragraphs.First().Append(dataFromDataGrid[k]).FontSize(11).Font(new FontFamily("Arial"));
k++;
}
}
document.Save();
我认为我没有按需要添加行,因为如果我在我的循环中运行直到:
for (int i = 1; i <howManyRows; i++)
不喜欢:
for (int i = 1; i <=howManyRows; i++)
正如我在下面所做的那样,我得到了这张表:如图所示,行中没有单元格和边框,这可能是我不知道的问题。
最佳答案
我找到了这个link
特别是关于
的部分this.Tables[1].set_Style("Table Grid 8");
尝试样式部分。
另外,这个link ,它显示了一个完整的例子,它使用
table.Borders
这看起来像你要找的东西:)
干杯
荣兰
关于c# - 使用 DocX dll 将行添加到 word 文件(doc 文件)中的现有表,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/39973267/
我有一个 Windows Service(一个发布版本),我替换了一个在 Debug模式下构建的 DLL 并尝试启动服务。它引发了错误无法加载文件或程序集“名称”或其依赖项之一。尝试加载格式不正确的程
我使用 Microsoft Visual Basic 6.0 Enterprise Edition SP6 开发了一个 VB6 应用程序。 我已将可执行文件复制到未安装 VB6 的计算机 C。 我已在
我有很多小的 DLL,我想将它们组合成一个大的(更)DLL(如 suggested here)。我可以通过合并我的项目来做到这一点,但我想要一种不那么干扰的方式。 可以将多个 DLL 合并为一个单元吗
我想将非托管 DLL 和图像文件与托管 DLL 合并。我该怎么做?可能吗? 最佳答案 很有可能。这可以通过 bxilmerge 来完成此解决方案可以将非托管 DLL 和图像或其他文件与托管 DLL 合
如何在Windows Server 2003上安装msvcr71.dll,这是我的软件所需的。我真的不想将此dll复制到system32文件夹,因为它可能会破坏此目标系统。 最佳答案 只需将其复制到程
我最近遇到了一个安装在我的系统上的 DLL,Dependancy Walker(以及我尝试过的所有其他实用程序)说按名称或顺序导出为零,但文件大小约为 4mb。我认为 DLL 的唯一目的是导出供其他代
我终于让我的本地主机在本地显示该站点。一切似乎都在朝着这个方向努力。我的下一步是当网站使用 ActiveX.dll 中的函数时,实际上能够从 VB6 IDE 进入代码 更新: 我更新了代码并删除了我在
首先,我指的是Windows环境和VC++编译器。 我想要做的是重建一个Vc++ dll并与已经链接到该lib的exe保持兼容性,而不必重建该exe或使用LoadLibrary动态加载该dll。换句话
我以前这样做过,我不记得我是从网上下载的 DLL 还是其他东西,但我不想感染病毒。我需要访问这个命名空间,以便我可以拥有 Webbrowswer 控件不提供的额外功能。 如何准确添加 Com 引用。还
我正在尝试为依赖于 ghostscript 的库创建 Nuget 包,因此引用 gsdll32.dll - 一个非托管库。我不能只包含一个标准的 dll 引用。我应该把它放在 nuget 目录结构中的
如果我有 Windows 可执行文件,我如何找出它将加载哪些 dll? 我只是谈论哪些将静态加载,而不是那些可能使用 LoadLibrary 等动态加载的内容。 最佳答案 dumpbin是VC++自带
这可能是一个非常菜鸟的问题,但在当今的网络应用程序开发世界中,许多程序员不需要过多处理 dll,因此也懒得去了解它们的用途。 那么什么是dll? 它有什么用? 它是如何工作的? 如何创建一个? 在什么
所以我刚刚开始使用 OpenTK,并将此代码放在一个继承 GameWindow 类的类中: protected override void OnRenderFrame(FrameEventArgs e
如何调试未由 java 应用程序加载的 dll。 场景是这样的:我的 java 应用正在加载正在使用另一个 dll 的 jni.dll,而那个 dll 正在使用另一个 dll。 javajni.dll
我将“更好”放在引号中,因为这是一个定性问题。几年来我一直在编写 COM DLL,直到最近才发现并成功使用了带有 Typelib 概念的标准 DLL。 使用 COM DLL 代替 DLL+Typeli
这种用户机器可能没有msvcp100.dll、msvcp100.dll之类dll的情况怎么处理?我不希望我的软件因为这种错误而无法安装在用户的机器上。我一直在考虑要么找到一个工具并将每个需要的 dll
在 VS2012 中使用 C# .NET 和 COM 互操作,我正在开发一个用于其他几个程序的公共(public)库。为了简化集成,我想将整个库缩减为一个 DLL。该库的特点之一是本地化。它有包含多种
我在 .Net 中使用 FieldTalk Modbus。当我运行应用程序时,我在为 MbusTcpMasterProtocol 创建对象时遇到错误。 MbusTcpMasterProtocol mb
我想指出,我知道如何向/从 GAC 添加/删除程序集。我要问的是,是否有人可以从技术角度向我解释它是如何工作的。将 dll 放在那里有什么意义 - 从节省资源的角度来看。 亲切的问候 最佳答案 将东西
我继承了一个传统的经典 ASP 应用程序,它使用 VB6 ActiveX DLL 来执行业务逻辑。 我想跟踪加载和卸载 DLL 的点。有没有办法在 VB6 DLL 中拦截这些事件? 在相关说明中,Cl
我是一名优秀的程序员,十分优秀!