如何使用C#在Windows Word中制作表格的副本

编程入门 行业动态 更新时间:2024-10-26 20:27:21
本文介绍了如何使用C#在Windows Word中制作表格的副本的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧! 问题描述

, 我想使用C#在寡妇字中复制现有表格.任何想法? 谢谢! Soumya

Hi, I would like to make a copy of an existing table in widows word using C#.Any ideas?? Thanks! Soumya

推荐答案

以下C#代码将帮助您使用Office interop assebly复制现有表: Below C# code will help you to copy the existing table using Office interop assebly: using Microsoft.Office.Interop.Word; Word.Range range = table.Range; range.Copy(); Word.Range rng = table.Range; rng.SetRange(table.Range.End, table.Range.End); Word.Table tableCopy = document.Tables.Add(rng, 1, 1, ref missing, ref missing); tableCopy.Range.Paste();

//docTable是表1 //tableCopy是表2,它是表1的副本 范围范围= docTable.Range; range.Copy(); range.SetRange(docTable.Range.End +1,docTable.Range.End +1); 表格tableCopy = doc.Tables.Add(rng,1,1,缺少参考,缺少参考); tableCopy.Range.Paste(); // docTable is the Table 1 // tableCopy is the Table 2 which is the Replica of Table 1 Range range = docTable.Range; range.Copy(); range.SetRange(docTable.Range.End + 1, docTable.Range.End + 1); Table tableCopy = doc.Tables.Add(rng, 1, 1, ref missing, ref missing); tableCopy.Range.Paste();

更多推荐

如何使用C#在Windows Word中制作表格的副本

本文发布于:2023-11-09 16:03:13,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1572812.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:副本   如何使用   表格   Word   Windows

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!