回复 2楼iceman的帖子
好的 文件里面是一个测试表 进行复制的代码如下
public Worksheet CopySheet (Worksheet sheet,string newName)
{
Worksheet newSheet = null;
if (sheet != null)
{
MemoryStream ms = new MemoryStream();
XmlWriter writer = XmlWriter.Create(ms);
sheet.SaveXml(writer);
writer.Close();
ms.Position = 0;
XmlReader reader = XmlReader.Create(ms);
newSheet = new Worksheet(newName);
newSheet.OpenXml(reader);
reader.Close();
}
return newSheet;
} |
|