本文整理汇总了C#中Microsoft.Office.Interop.Word.Document类的典型用法代码示例。如果您正苦于以下问题:C# Document类的具体用法?C# Document怎么用?C# Document使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
Document类属于Microsoft.Office.Interop.Word命名空间,在下文中一共展示了Document类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C#代码示例。
示例1: UrlListForm
public UrlListForm(Word.Document doc)
{
InitializeComponent();
if (doc == null)
return;
wordDoc = doc;
hyperlink_urls = WordUrlManager.GetListOfHyperlinkUrls(doc);
hyperlink_requests = new HttpWebRequest[hyperlink_urls.Length];
autofind_urls = WordUrlManager.GetListOfAllUrls(doc);
autofind_requests = new HttpWebRequest[autofind_urls.Length];
active_urls = hyperlink_urls;
active_requests = hyperlink_requests;
InitializeUrlViewList();
progressBar.Visible = true;
if (active_urls.Length == 0)
progressBar.Visible = false;
progressBar.Minimum = 0;
progressBar.Maximum = active_urls.Length;
progressBar.Step = 1;
progressBar.Value = 0;
button_RecheckEveryURL.Enabled = false;
radioButton_autofindUrls.Enabled = false;
radioButton_wordHyperlinks.Enabled = false;
listView.BeginUpdate();
urlTesterThread = null;
RestartTestingThread = null;
urlTesterThread_shouldStop = false;
}
开发者ID:ggmod,项目名称:WordSyntaxHighlighter,代码行数:34,代码来源:UrlListForm.cs
示例2: Convert
public override void Convert(String inputFile, String outputFile)
{
Object nothing = System.Reflection.Missing.Value;
try
{
if (!File.Exists(inputFile))
{
throw new ConvertException("File not Exists");
}
if (IsPasswordProtected(inputFile))
{
throw new ConvertException("Password Exist");
}
app = new Word.Application();
docs = app.Documents;
doc = docs.Open(inputFile, false, true, false, nothing, nothing, true, nothing, nothing, nothing, nothing, false, false, nothing, true, nothing);
doc.ExportAsFixedFormat(outputFile, Word.WdExportFormat.wdExportFormatPDF, false, Word.WdExportOptimizeFor.wdExportOptimizeForOnScreen, Microsoft.Office.Interop.Word.WdExportRange.wdExportAllDocument, 1, 1, Word.WdExportItem.wdExportDocumentContent, false, false, Word.WdExportCreateBookmarks.wdExportCreateNoBookmarks, false, false, false, nothing);
}
catch (Exception e)
{
release();
throw new ConvertException(e.Message);
}
release();
}
开发者ID:teambition,项目名称:OfficeConverter,代码行数:27,代码来源:WordConverter.cs
示例3: getAttrValueInTag
public String getAttrValueInTag(String tag, String attr, String subject)
{
if (log.IsInfoEnabled) log.Info("Begin");
if (log.IsDebugEnabled) log.Debug("getAttrValueInTag(tag: " + tag + ", attr: " + attr + ")");
/* Declaración de variables */
String subjectString = null;
String result = null;
String pattern = null;
Regex regexObj = null;
Match matchResults = null;
RegexOptions options = RegexOptions.IgnoreCase;
/* Inicializamos variables */
ActiveDocument = Globals.ThisAddIn.Application.ActiveDocument;
pattern = @"\[" + tag + ".*?" + attr + @"=("".*?""|'.*?'|[^\ \]]*).*?\]";
pattern = "\\[" + tag + ".*?" + attr + "=(\\\".*?\\\"|\\'.*?\\'|[^\\ \\]]*).*?\\]";
subjectString = ActiveDocument.Content.Text;
if (subject != null)
subjectString = subject;
/* Verificamos que haya coincidencia */
regexObj = new Regex(pattern, options);
matchResults = regexObj.Match(subjectString);
if (matchResults.Success)
{
result = matchResults.Groups[1].Value;
if (result.EndsWith("\"") || result.EndsWith("'"))
{
result = result.Substring(1, result.Length - 2);
}
}
if (log.IsInfoEnabled) log.Info("End");
return result;
}
开发者ID:swarzesherz,项目名称:RegexMarkup,代码行数:32,代码来源:Utils.cs
示例4: TechDoc2
public TechDoc2(string TemplateFilename, bool Visible)
{
CurrentTechSection = 0;
CurrentTechLine = 0;
ItemSectionFormat = "{0}. ";
ItemLineFormat = "{0}.{1}. ";
WORDApp = new Word.ApplicationClass();
WORDApp.Visible = true;
object useDefaultValue = Type.Missing;
object visible = Visible;
object template = TemplateFilename;
doc = WORDApp.Documents.Add(ref template, ref useDefaultValue, ref useDefaultValue, ref visible);
//настройка стилей
Word.Style SectionStyle = doc.Styles[Word.WdBuiltinStyle.wdStyleHeading1];
SectionStyle.Font.Color = Word.WdColor.wdColorBlack;
SectionStyle.Font.Name = "Calibri";
SectionStyle.Font.Size = 16;
Word.Style NormalStyle = doc.Styles[Word.WdBuiltinStyle.wdStyleNormal];
NormalStyle.Font.Color = Word.WdColor.wdColorBlack;
NormalStyle.Font.Name = "Calibri";
NormalStyle.Font.Size = 12;
//список таблиц документа
TablesList = new Dictionary<string, Word.Table>();
//список литературы
BiblioList = new List<BiblioSource>();
}
开发者ID:VLunev,项目名称:RachetRR4,代码行数:31,代码来源:TechDoc2_WithOfficeInterop.cs
示例5: A
public A()
{
oracon = new OracleConnection("server = 127.0.0.1/orcx; user id = qzdata; password = xie51");
oracon2 = new OracleConnection("server = 10.5.67.11/pdbqz; user id = qzdata; password = qz9401tw");
wordapp = new word.Application();
worddoc = new word.Document();
worddoc = wordapp.Documents.Add();
worddoc.SpellingChecked = false;
worddoc.ShowSpellingErrors = false;
// wordapp.Visible = true;
ta.wordapp = wordapp;
ta.worddoc = worddoc;
if (IS_YEAR)
{
datestr = dsf.GetDateStr(the_year_begin_int, the_month_begin_int, the_year_end_int, the_month_end_int);
}
else
{
datestr = dsf.GetDateStr(the_date);
}
// datestr_abid = "(" + datestr + "and a.ab_id >=1 and a.ab_id <= 7)";
datestr_abid = "(" + datestr + "and" + abidstr + ")";
oracon2.Open();
orahlper = new OraHelper(oracon2);
orahlper.feedback = true;
the_month_begin = new DateTime(the_date.Year, the_date.Month, 1, 0, 0, 0);
the_month_end = the_month_begin.AddMonths(1).AddSeconds(-1);
}
开发者ID:xiexi1990,项目名称:ReportGen,代码行数:33,代码来源:Program.cs
示例6: TEditSidebar
public TEditSidebar(Word.Document WordDoc)
{
InitializeComponent();
AxiomIRISRibbon.Utility.setTheme(this);
this.tabDebug.Visibility = System.Windows.Visibility.Hidden;
if (Globals.ThisAddIn.getDebug())
{
this.tabDebug.Visibility = System.Windows.Visibility.Visible;
}
this.D = Globals.ThisAddIn.getData();
this.Doc = WordDoc;
// Initiatlise the tables to hold the XML
this.DTClauseXML = new DataTable();
this.DTClauseXML.TableName = "ClauseXML";
this.DTClauseXML.Columns.Add(new DataColumn("Id", typeof(String)));
this.DTClauseXML.Columns.Add(new DataColumn("XML", typeof(String)));
this.CurrentConceptId = "";
this.CurrentClauseId = "";
this.CurrentElementId = "";
this.RefreshConceptList();
this.GetDropDowns();
this.ClauseLock = true;
this.ForceRereshClauseXML = false;
}
开发者ID:santoshsaha,项目名称:AxiomCS-Ribbon,代码行数:30,代码来源:TEditSidebar.xaml.cs
示例7: WordDocument
public WordDocument(String templateName, bool visible)
{
List<int> startedWords = new List<int>();
foreach (Process p in System.Diagnostics.Process.GetProcessesByName("winword"))
{
startedWords.Add(p.Id);
}
Object missingValue = Missing.Value;
Object template = templateName;
if (wordapp == null)
wordapp = new Word.Application();
foreach (Process p in System.Diagnostics.Process.GetProcessesByName("winword"))
{
if (!startedWords.Contains(p.Id))
{
IDs.Add(p.Id);
}
}
wordapp.Visible = visible;
doc = wordapp.Documents.Add(ref template,
ref missingValue, ref missingValue, ref missingValue);
doc.ActiveWindow.Selection.MoveEnd(Word.WdUnits.wdStory);
tempFileName = Path.Combine(Path.GetDirectoryName(templateName), tempFileName);
}
开发者ID:Tinkris,项目名称:TeemTest,代码行数:28,代码来源:WordDocument.cs
示例8: setup
public void setup()
{
wordApp = WordApplicationHelper.GetApplication();
if (wordApp.Documents.Exists(IOHelpers.FirmAddressTestData))
wordApp.Documents.First(IOHelpers.FirmAddressTestData).Close(Wd.WdSaveOptions.wdDoNotSaveChanges);
doc = wordApp.Documents.Open(IOHelpers.FirmAddressTestData.FullName);
}
开发者ID:beachandbytes,项目名称:GorillaDocs,代码行数:7,代码来源:FirmAddressTests.cs
示例9: AddToc
public void AddToc()
{
wordApp = new Application();
object file = filePath;
try
{
wordDocument = wordApp.Documents.Open(ref file, ref paramMissing, ref paramMissing,
ref paramMissing, ref paramMissing, ref paramMissing,
ref paramMissing, ref paramMissing, ref paramMissing,
ref paramMissing, ref paramMissing, ref paramMissing,
ref paramMissing, ref paramMissing, ref paramMissing,
ref paramMissing
);
Range tocRange = wordDocument.Range(0, 0);
TableOfContents toc = wordDocument.TablesOfContents.Add(tocRange, ref paramMissing, ref paramMissing, ref paramMissing, ref paramMissing, ref paramMissing, ref paramMissing, ref paramMissing, ref paramMissing, ref paramMissing, ref paramMissing, ref paramMissing);
toc.Update();
int end = toc.Range.End;
Range tocEnd = wordDocument.Range(end, end);
tocEnd.InsertParagraphBefore();
tocEnd.InsertBreak(WdBreakType.wdPageBreak);
}
catch (COMException ex)
{
throw new InvalidOperationException("Invalid Document", ex);
}
finally {
Dispose();
}
}
开发者ID:amilasurendra,项目名称:pdf-generator,代码行数:35,代码来源:PostProcessor.cs
示例10: WordGenerator
/// <summary>
/// Generates a word instance
/// </summary>
/// <param name="settings"></param>
private WordGenerator(NamedLookup settings, bool silent) : base(settings, silent)
{
app = new Word.Application();
app.Visible = !this.silent;
document = app.Documents.Add(Type.Missing, Type.Missing,
Word.WdNewDocumentType.wdNewBlankDocument, !this.silent);
document.UserControl = !this.silent;
}
开发者ID:acas,项目名称:tfs-release-notes,代码行数:12,代码来源:WordGenerator.cs
示例11: AnnotationDisplay
public AnnotationDisplay(Word.Document doc)
{
this.document = doc;
displayedAnnotations = new List<Microsoft.Office.Interop.Word.Comment>();
document.TextLineEnding = Microsoft.Office.Interop.Word.WdLineEndingType.wdLFOnly;
document.Content.TextRetrievalMode.IncludeFieldCodes = true;
document.Content.TextRetrievalMode.IncludeHiddenText = true;
deletedCharsMap = document.Content.MapDeletedCharsOffsets();
clearContent = document.Content.GetCleanedText();
}
开发者ID:xwiki-contrib,项目名称:xwiki-office,代码行数:10,代码来源:AnnotationDisplay.cs
示例12: ComposeDocument
private void ComposeDocument(RepositoryInfo repositoryInfo, IList<Issue> issues, Document document)
{
foreach (Range tmpRange in document.StoryRanges)
{
Replace(repositoryInfo.ProjectName, ProjectNameContainer, tmpRange);
Replace(repositoryInfo.Hash, VersionContainer, tmpRange);
Replace(repositoryInfo.Date, PublicationDateContainer, tmpRange);
Replace(issues.ToText(), SolvedTicketsContainer, tmpRange);
}
}
开发者ID:elpikel,项目名称:Publisher,代码行数:10,代码来源:DocumentBuilder.cs
示例13: ConfirmForm
public ConfirmForm(ThisAddIn myThisAddIn, Word.Application WordApp, object FileName)
{
InitializeComponent();
this.myThisAddIn = myThisAddIn;
this.WordApp = WordApp;
this.FileName = FileName;
OldDocument = WordApp.ActiveDocument;
isCancelFlag = false;
ClosePrintPreviewThread = new Thread(new ThreadStart(ClosePrintPreviewListener));
ClosePrintPreviewThread.Start();
}
开发者ID:chendaxixi,项目名称:WordAddIn,代码行数:11,代码来源:ConfirmForm.cs
示例14: documentListBox_SelectedIndexChanged
private void documentListBox_SelectedIndexChanged(object sender, EventArgs e)
{
// When a document is selected in the list, change the current selected document
if (documentListBox.SelectedIndex >= 0)
{
if (wordObj != null)
{
docObj = wordObj.Documents[documentListBox.SelectedIndex + 1];
}
}
}
开发者ID:rfoligno,项目名称:word_countdown,代码行数:11,代码来源:MainForm.cs
示例15: translateButton_Click
private void translateButton_Click(object sender, RibbonControlEventArgs e)
{
document = (Word.Document)inspector.WordEditor;
if (document != null)
{
string selected = document.Application.Selection.Text;
if (selected.Length > 0)
{
document.Application.Selection.Text = translate(selected);
}
}
}
开发者ID:dunckr,项目名称:outlook-translate,代码行数:12,代码来源:MailRibbon.cs
示例16: Generator
public Generator(System.Data.DataTable dt)
{
path = System.AppDomain.CurrentDomain.BaseDirectory.ToString() + "uploadfile\\岗位责任书.doc";
wordApp = new MSWord.Application();
if (File.Exists((string)path))
{
File.Delete((string)path);
}
Nothing = Missing.Value;
wordDoc = wordApp.Documents.Add(ref Nothing, ref Nothing, ref Nothing, ref Nothing);
wordApp.Selection.ParagraphFormat.LineSpacing = 16;
this.dt = dt;
}
开发者ID:cntimothy,项目名称:TJEvaluationSystem,代码行数:13,代码来源:Generator.cs
示例17: WordOpen
private void WordOpen(string strFileName)
{
object fileName = strFileName;
object readOnly = false;
object isVisible = true;
_WordDoc = _WordApplication.Documents.Open(ref fileName, ref missing, ref readOnly,
ref missing, ref missing, ref missing, ref missing, ref missing, ref missing,
ref missing, ref missing, ref isVisible, ref missing, ref missing, ref missing, ref missing);
_WordDoc.Activate();
}
开发者ID:imdmmp,项目名称:kpgweigher,代码行数:13,代码来源:WindowsExternal.cs
示例18: DocParser
public DocParser(object fileName)
{
WordApp = new Word.Application();
doc = WordApp.Documents.Open(ref fileName, ref missing, ref readOnly,
ref missing, ref missing, ref missing,
ref missing, ref missing, ref missing,
ref missing, ref missing, ref isVisible,
ref missing, ref missing, ref missing,
ref missing);
parsedFile = new ContentFile()
{
contentRaw = doc.WordOpenXML,
contentText = GetFileContent(),
};
}
开发者ID:sashaMilka,项目名称:MultiReader,代码行数:15,代码来源:DocParser.cs
示例19: Open
/// <summary>
/// 打开Word文档
/// </summary>
public void Open()
{
object path = this.fileName;
cls = new Microsoft.Office.Interop.Word.Application();
cls.Visible = true;
//object missing = System.Reflection.Missing.Value;
//object strNewPath = "E:\\堆芯\\附件4-CoreEasy输出参数表.docx";
try
{
doc = cls.Documents.Open(ref path, ref missing, ref missing, ref missing, ref missing, ref missing, ref missing, ref missing, ref missing, ref missing, ref missing, ref missing, ref missing, ref missing, ref missing, ref missing);
openState = true;
}
catch
{
openState = false;
MessageBox.Show("打开< "+ path +" >失败!","提示");
}
}
开发者ID:algz,项目名称:ReactiveControlAnalysis,代码行数:21,代码来源:CReadWordFile.cs
示例20: SaveContract
public bool SaveContract(bool ForceSave, bool SaveDoc)
{
string strFileAttached = _fileName;
//Save the Contract
Globals.ThisAddIn.RemoveSaveHandler(); // remove the save handler to stop the save calling the save etc.
Globals.ThisAddIn.ProcessingStart("Save Contract");
DataReturn dr;
_doc = Globals.ThisAddIn.Application.ActiveDocument;
dr = AxiomIRISRibbon.Utility.HandleData(_d.SaveVersion(_versionid, _matterid, _templateid, _versionName, _versionNumber));
if (!dr.success) return false;
_versionid = dr.id;
if (SaveDoc)
{
//Save the file as an attachment
//save this to a scratch file
Globals.ThisAddIn.ProcessingUpdate("Save Scratch");
// string filename = AxiomIRISRibbon.Utility.SaveTempFile(_versionid);
_doc.SaveAs2(FileName: strFileAttached, FileFormat: Word.WdSaveFormat.wdFormatXMLDocument, CompatibilityMode: Word.WdCompatibilityMode.wdCurrent);
//Save a copy!
Globals.ThisAddIn.ProcessingUpdate("Save Copy");
string filenamecopy = AxiomIRISRibbon.Utility.SaveTempFile(_versionid + "X");
Word.Document dcopy = Globals.ThisAddIn.Application.Documents.Add(strFileAttached, Visible: false);
dcopy.SaveAs2(FileName: filenamecopy, FileFormat: Word.WdSaveFormat.wdFormatXMLDocument, CompatibilityMode: Word.WdCompatibilityMode.wdCurrent);
var docclose = (Microsoft.Office.Interop.Word._Document)dcopy;
docclose.Close();
System.Runtime.InteropServices.Marshal.ReleaseComObject(docclose);
//Now save the file - change this to always save as the version name
Globals.ThisAddIn.ProcessingUpdate("Save To SalesForce");
string vfilename = _versionName.Replace(" ", "_") + ".docx";
dr = AxiomIRISRibbon.Utility.HandleData(_d.UpdateFile(_attachmentid, vfilename, filenamecopy));
}
Globals.ThisAddIn.AddSaveHandler(); // add it back in
Globals.ThisAddIn.ProcessingStop("End");
return true;
}
开发者ID:santoshsaha,项目名称:AxiomCS-Ribbon01,代码行数:44,代码来源:CompareSideBar.xaml.cs
注:本文中的Microsoft.Office.Interop.Word.Document类示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论