//合并
object wdunit = WdUnits.wdStory; object wdEx = WdMovementType.wdExtend;
object saveChanges = false, of = Word.WdOriginalFormat.wdOriginalDocumentFormat, rd = System.Reflection.Missing.Value;
//wClass.WordApplication.Quit(ref saveChanges, ref of, ref rd);
saveChanges = false; of = Word.WdOriginalFormat.wdOriginalDocumentFormat; rd = System.Reflection.Missing.Value;
//wClass2.WordApplication.Quit(ref saveChanges, ref of, ref rd);
lblTip.Text = "正在合并, 请等待... ";
//wClass = new WordClass();
wClass.OpenWordDoc(FileOperate.WellHistoryPath + @"\00.doc");
System.Threading.Thread.Sleep(200);
for (int j = 1; j <= clbPart.Items.Count; j++)
{
if (isCancel == true)
return;
if (jsArr[j, 0] == "1") // '如果是"1", 则选择了该项
{
//wClass.delEndBLKLine();
wClass.WordApplication.Selection.ParagraphFormat.Alignment = WdParagraphAlignment.wdAlignParagraphLeft;
a1 = ""; a2 = false; a3 = false; a4 = false;
string docfilename = FileOperate.WellHistoryPath + @"\" + j.ToString("0#") + ".doc";
wClass.GotoWordEnd(false);
wClass.WordApplication.Selection.InsertFile(docfilename, ref a1, ref a2, ref a3, ref a4);
System.Windows.Forms.Application.DoEvents();
System.Threading.Thread.Sleep(100);
}
}
wClass.GotoWordBegin(false);
wClass.ReplaceAll("###JH###", JH);
for (int i = 2; i <= wClass.WordApplication.ActiveDocument.Sections.Count; i++)
{
wClass.GotoWordSection(i);
if (wClass.WordApplication.ActiveWindow.ActivePane.View.Type == WdViewType.wdNormalView
|| wClass.WordApplication.ActiveWindow.ActivePane.View.Type == WdViewType.wdOutlineView)
wClass.WordApplication.ActiveWindow.ActivePane.View.Type = WdViewType.wdPrintView;
wClass.WordApplication.ActiveWindow.ActivePane.View.SeekView = WdSeekView.wdSeekCurrentPageHeader;
wClass.GotoWordEnd(false)
wClass.ReplaceAll("###JH###", JH);
wClass.SaveAs(FileOperate.WellHistoryPath + @"\" + JH + "措施施工设计.doc");
wClass.Close(true);
//
string strMoudleFile = FileOperate.WellHistoryPath + @"\" + JH + "措施施工设计.doc";
if (File.Exists(strMoudleFile))
{
Process p = new Process();
p.StartInfo.FileName = strMoudleFile;
p.StartInfo.UseShellExecute = true;
p.StartInfo.CreateNoWindow = true;
p.Start();
}
1、好歹悬赏点豆子,不然哪有人来看;
2、求解释,解释什么?每句代码都给你解释?那代价可不小哦~