C#code selection.goto不适用于2013年 [英] C# code selection.goto does not work with word 2013
本文介绍了C#code selection.goto不适用于2013年的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
下面的代码片段selection.GoTo在Windows 7中使用Word 2010工作。但是,在Windows Windows 10中,
Word 2013会产生以下错误:
发生错误:此方法或属性不可用,因为此命令无法读取。
有谁知道原因和方法解决它?
代码片段:
The code snippet "selection.GoTo" below worked in Windows 7 using Word 2010. But, in Windows Windows 10,
Word 2013 produces the following error:
An error occured: This method or property is not available because this command is not available for reading.
Does anyone know why and how to fix it ?
Code snippet:
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.IO;
using Microsoft.Win32;
using System.Diagnostics;
using Word = Microsoft.Office.Interop.Word;
for (var pageIndex = 1; pageIndex <= pageCount; ++pageIndex)
{
var selection = winword.Selection;
selection.GoTo(
What: Word.WdGoToItem.wdGoToPage,
Which: Word.WdGoToDirection.wdGoToAbsolute,
Count: pageIndex);
var curPage1 = selection.Information[Word.WdInformation.wdActiveEndAdjustedPageNumber];
var curPage2 = selection.Information[Word.WdInformation.wdActiveEndPageNumber];
winword.ActiveWindow.ActivePane.View.SeekView = Word.WdSeekView.wdSeekCurrentPageFooter;
Word.Range range = selection.HeaderFooter.Range;
}
我的尝试:
google搜索并询问其他人
What I have tried:
google search and asking others
推荐答案
查看文档:Selection.GoTo方法(Microsoft.Office.Interop.Word ) [ ^ ]
这篇关于C#code selection.goto不适用于2013年的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文