本文整理汇总了C#中System.Windows.Forms.Document类的典型用法代码示例。如果您正苦于以下问题:C# Document类的具体用法?C# Document怎么用?C# Document使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
Document类属于System.Windows.Forms命名空间,在下文中一共展示了Document类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C#代码示例。
示例1: New
protected override void New(Document doc)
{
eduBindingSource.AddNew();
var editForm = new XtraDictionaryEditEduForm(this,
(List<municipality>)this.municipalityBindingSource.List, (List<edu_kind>)this.eduKindBindingSource.List, (edu)eduBindingSource.Current);
editForm.Show(this.ParentForm);
}
开发者ID:superbatonchik,项目名称:EduFormManager,代码行数:7,代码来源:XtraDictionaryEduControl.cs
示例2: button1_Click
private void button1_Click(object sender, EventArgs e)
{
//Create word document
Document document = new Document();
Section section = document.AddSection();
section.PageSetup.PageSize = PageSize.A4;
section.PageSetup.Margins.Top = 72f;
section.PageSetup.Margins.Bottom = 72f;
section.PageSetup.Margins.Left = 89.85f;
section.PageSetup.Margins.Right = 89.85f;
Paragraph paragraph = section.AddParagraph();
paragraph.Format.HorizontalAlignment = Spire.Doc.Documents.HorizontalAlignment.Left;
paragraph.AppendPicture(ToPDF.Properties.Resources.Word);
String p1
= "Microsoft Word is a word processor designed by Microsoft. "
+ "It was first released in 1983 under the name Multi-Tool Word for Xenix systems. "
+ "Subsequent versions were later written for several other platforms including "
+ "IBM PCs running DOS (1983), the Apple Macintosh (1984), the AT&T Unix PC (1985), "
+ "Atari ST (1986), SCO UNIX, OS/2, and Microsoft Windows (1989). ";
String p2
= "Microsoft Office Word instead of merely Microsoft Word. "
+ "The 2010 version appears to be branded as Microsoft Word, "
+ "once again. The current versions are Microsoft Word 2010 for Windows and 2008 for Mac.";
section.AddParagraph().AppendText(p1).CharacterFormat.FontSize = 14;
section.AddParagraph().AppendText(p2).CharacterFormat.FontSize = 14;
//Save doc file to pdf.
document.SaveToFile("Sample.pdf", FileFormat.PDF);
//Launching the pdf reader to open.
FileViewer("Sample.pdf");
}
开发者ID:spirecomponent,项目名称:Word-Library,代码行数:35,代码来源:Form1.cs
示例3: button1_Click
private void button1_Click(object sender, EventArgs e)
{
//Create word document
Document document = new Document();
Section section = document.AddSection();
//page setup
SetPage(section);
//insert header and footer
InsertHeaderAndFooter(section);
//add cover
InsertCover(section);
//insert a break code
section = document.AddSection();
section.BreakCode = SectionBreakType.NewPage;
//add content
InsertContent(section);
//Save doc file.
document.SaveToFile("Sample.doc", FileFormat.Doc);
//Launching the MS Word file.
WordDocViewer("Sample.doc");
}
开发者ID:spirecomponent,项目名称:Word-Library,代码行数:29,代码来源:Form1.cs
示例4: button1_Click
private void button1_Click(object sender, EventArgs e)
{
//Open a blank word document as template
Document document = new Document(@"..\..\..\..\..\..\Data\Blank.doc");
//Get the first secition
Section section = document.Sections[0];
//Create a new paragraph or get the first paragraph
Paragraph paragraph
= section.Paragraphs.Count > 0 ? section.Paragraphs[0] : section.AddParagraph();
//Append Text
paragraph.AppendText("Builtin Style:");
foreach (BuiltinStyle builtinStyle in Enum.GetValues(typeof(BuiltinStyle)))
{
paragraph = section.AddParagraph();
//Append Text
paragraph.AppendText(builtinStyle.ToString());
//Apply Style
paragraph.ApplyStyle(builtinStyle);
}
//Save doc file.
document.SaveToFile("Sample.doc",FileFormat.Doc);
//Launching the MS Word file.
WordDocViewer("Sample.doc");
}
开发者ID:e-iceblue,项目名称:Spire.Office-for-.NET,代码行数:32,代码来源:Form1.cs
示例5: InsertTemplate
private void InsertTemplate(Document document, string toInsert)
{
var textDocument = document.Object() as TextDocument;
textDocument.StartPoint.CreateEditPoint();
textDocument.Selection.Insert(toInsert);
}
开发者ID:K-Pavlov,项目名称:TemplatorAddIn,代码行数:7,代码来源:TemplateForm.cs
示例6: beginCommand
public static void beginCommand(Document doc, string strDomain, bool bForAllSystems = false, bool bFitlerUnCalculationSystems = false)
{
PressureLossReportHelper helper = PressureLossReportHelper.instance;
UIDocument uiDocument = new UIDocument(doc);
if (bFitlerUnCalculationSystems)
{
ElementSet calculationOnElems = new ElementSet();
int nTotalCount = getCalculationElemSet(doc, strDomain, calculationOnElems, uiDocument.Selection.Elements);
if (calculationOnElems.Size == 0)
{//No item can be calculated
popupWarning(ReportResource.allItemsCaculationOff, TaskDialogCommonButtons.Close, TaskDialogResult.Close);
return;
}
else if (calculationOnElems.Size < nTotalCount)
{//Part of them can be calculated
if (popupWarning(ReportResource.partOfItemsCaculationOff, TaskDialogCommonButtons.No | TaskDialogCommonButtons.Yes, TaskDialogResult.Yes) == TaskDialogResult.No)
return;
}
helper.initialize(doc, calculationOnElems, strDomain);
invokeCommand(doc, helper, bForAllSystems);
}
else
{
helper.initialize(doc, uiDocument.Selection.Elements, strDomain);
invokeCommand(doc, helper, bForAllSystems);
}
}
开发者ID:jeremytammik,项目名称:UserMepCalculation,代码行数:29,代码来源:PressureLossReportEntry.cs
示例7: Save
protected override void Save(Document doc)
{
if (this.CanSave(doc))
{
this.munitEditControl.Save();
}
}
开发者ID:superbatonchik,项目名称:EduFormManager,代码行数:7,代码来源:XtraDictionaryMunitControl.cs
示例8: GetChildren
/// <summary>
/// Recursively retrieve entire linked document
/// hierarchy and return the resulting TreeNode
/// structure.
/// </summary>
void GetChildren(
Document mainDoc,
ICollection<ElementId> ids,
TreeNode parentNode )
{
int level = parentNode.Level;
foreach( ElementId id in ids )
{
// Get the child information.
RevitLinkType type = mainDoc.GetElement( id )
as RevitLinkType;
string label = LinkLabel( type, level );
TreeNode subNode = new TreeNode( label );
Debug.Print( "{0}{1}", Indent( 2 * level ),
label );
parentNode.Nodes.Add( subNode );
// Go to the next level.
GetChildren( mainDoc, type.GetChildIds(),
subNode );
}
}
开发者ID:jeremytammik,项目名称:ListLinkType,代码行数:34,代码来源:Command.cs
示例9: getTestSpecificationDocTOC
public Dictionary<string, List<TermContainer>> getTestSpecificationDocTOC(Document doc, ApplicationClass app)
{
generateTOC(doc, app);
Range tocRange = doc.TablesOfContents[1].Range;
string[] tocContents = delimiterTOC(tocRange.Text);
Dictionary<string, List<TermContainer>> dict = new Dictionary<string, List<TermContainer>>();
string chapter = "";
foreach (string s in tocContents)
{
if (isLevel1(s))
{
chapter = s;
dict.Add(s, new List<TermContainer>());
}
else
{
if (isLevel2(s))
{
TermContainer term = new TermContainer("", s, null);
dict[chapter].Add(term);
}
}
}
return dict;
}
开发者ID:v02zk,项目名称:Mycoding,代码行数:28,代码来源:HandleDocument.cs
示例10: GetRegions
public async Task< IEnumerable<ICodeRegion>> GetRegions(Document document)
{
_documentText = getDocumentText(document);
if (_documentText == null) return null;
return GetRegions(_documentText);
}
开发者ID:stickleprojects,项目名称:ClassOutline,代码行数:7,代码来源:RegionParser.cs
示例11: AddDocument
public static void AddDocument(Document doc)
{
_documents.Enqueue(doc);
Debug.WriteLine($"Number of Documents: {_documents.Count}");
if (_hhook == IntPtr.Zero)
SetEventHook();
}
开发者ID:smilinger,项目名称:MyVaultBrowser,代码行数:7,代码来源:StandardAddInServer.cs
示例12: Execute
/// <summary>
/// Implement this method as an external command for Revit.
/// </summary>
/// <param name="commandData">An object that is passed to the external application
/// which contains data related to the command,
/// such as the application object and active view.</param>
/// <param name="message">A message that can be set by the external application
/// which will be displayed if a failure or cancellation is returned by
/// the external command.</param>
/// <param name="elements">A set of elements to which the external application
/// can add elements that are to be highlighted in case of failure or cancellation.</param>
/// <returns>Return the status of the external command.
/// A result of Succeeded means that the API external method functioned as expected.
/// Cancelled can be used to signify that the user cancelled the external operation
/// at some point. Failure should be returned if the application is unable to proceed with
/// the operation.</returns>
public Autodesk.Revit.UI.Result Execute(Autodesk.Revit.UI.ExternalCommandData commandData, ref string message, Autodesk.Revit.DB.ElementSet elements)
{
Autodesk.Revit.UI.UIApplication application = commandData.Application;
m_docment = application.ActiveUIDocument.Document;
try
{
// user should select one slab firstly.
if(application.ActiveUIDocument.Selection.Elements.Size == 0)
{
MessageBox.Show("Please select one slab firstly.", "Revit", MessageBoxButtons.OK, MessageBoxIcon.Warning);
return Autodesk.Revit.UI.Result.Cancelled;
}
// get the selected slab and show its span direction
ElementSet elementSet = application.ActiveUIDocument.Selection.Elements;
ElementSetIterator elemIter = elementSet.ForwardIterator();
elemIter.Reset();
while (elemIter.MoveNext())
{
Floor floor = elemIter.Current as Floor;
if (floor != null)
{
GetSpanDirectionAndSymobls(floor);
}
}
}
catch(Exception ex)
{
message = ex.ToString();
return Autodesk.Revit.UI.Result.Failed;
}
return Autodesk.Revit.UI.Result.Succeeded;
}
开发者ID:AMEE,项目名称:revit,代码行数:49,代码来源:Command.cs
示例13: btnOK_Click
private void btnOK_Click(object sender, EventArgs e)
{
if (!string.IsNullOrEmpty(this.txtSaveDir.Text) &&
!string.IsNullOrEmpty(this.txtProjectName.Text))
{
string selectDir = this.txtSaveDir.Text.Trim();
string projectName = this.txtProjectName.Text.Trim();
string path = System.IO.Path.Combine(selectDir, this.txtProjectName.Text.Trim());
System.IO.Directory.CreateDirectory(path);
DBGlobalService.ProjectFile = System.IO.Path.Combine(path, projectName+".xml");
//doc.SetSchemaLocation(GlobalService.ConfigXsd);
if (!System.IO.File.Exists(DBGlobalService.ProjectFile))
{
var stream = System.IO.File.Create(DBGlobalService.ProjectFile);
stream.Close();
}
var doc = new Document();
DBGlobalService.CurrentProjectDoc = doc;
//doc.Load(GlobalService.ProjectFile);
var prj = doc.CreateNode<ProjectType>();
doc.Root = prj;
DBGlobalService.CurrentProject = prj;
DBGlobalService.CurrentProject.Name = projectName ;
doc.Save(DBGlobalService.ProjectFile);
this.DialogResult = System.Windows.Forms.DialogResult.OK;
this.Close();
}
}
开发者ID:koksaver,项目名称:CodeHelper,代码行数:33,代码来源:CreatePorjectFrm.cs
示例14: DocumentViewModel
public DocumentViewModel(Document document, IDocumentService documentService)
{
this.service = documentService;
this.Model = document;
this.mode = DocumentMode.Edit;
this.IsBusy = false;
}
开发者ID:binaryfr3ak,项目名称:Documentania,代码行数:7,代码来源:DocumentViewModel.cs
示例15: button1_Click
private void button1_Click(object sender, EventArgs e)
{
//Create word document
Document document = new Document();
Section section = document.AddSection();
//page setup
SetPage(section);
//insert header and footer
InsertHeaderAndFooter(section);
//add content
InsertContent(section);
//encrypt document with password specified by textBox1
document.Encrypt(this.textBox1.Text);
//Save doc file.
document.SaveToFile("Sample.doc",FileFormat.Doc);
//Launching the MS Word file.
WordDocViewer("Sample.doc");
}
开发者ID:e-iceblue,项目名称:Spire.Office-for-.NET,代码行数:27,代码来源:Form1.cs
示例16: Execute
public Result Execute(ExternalCommandData commandData, ref string message, ElementSet elements)
{
//setup class variables
_dbDoc = commandData.Application.ActiveUIDocument.Document;
_uiDoc = commandData.Application.ActiveUIDocument;
//setup ScoreKeeper
_scoreKeeper = new ScoreKeeper(_dbDoc);
//Find out which game to play
NewGameMenu menu = new NewGameMenu();
DialogResult result = menu.ShowDialog();
//check if they want to reset the scores
//using a dialog result of No to trigger this.
if (result == DialogResult.No)
{
_scoreKeeper.ResetScores();
return Result.Succeeded;
}
if (result != DialogResult.OK)
return Result.Cancelled;
//setup the game
IGame game = SetupGame(menu.IsOnlineGame());
//run the game
game.StartGame();
return Result.Succeeded;
}
开发者ID:RodH257,项目名称:RevitTicTacToe,代码行数:32,代码来源:Command.cs
示例17: changeFamiliesNames
public void changeFamiliesNames(Document doc)
{
//Gets the families
Family familyNames = null;
FilteredElementCollector collector = new FilteredElementCollector(doc);
ICollection<Element> collection = collector.OfClass(typeof(Family)).ToElements();
ValueDictionary dictionaryList = new ValueDictionary();
var dictionary = dictionaryList.GetRenameFamilies();
using (Transaction t = new Transaction(doc))
{
t.Start("new name");
foreach (Element e in collection)
{
familyNames = e as Family;
string familyName = familyNames.Name;
//Checks the dictionary and if found renames the family
if (dictionary.ContainsKey(familyName))
{
string value = dictionary[familyName];
familyNames.Name = value;
count++;
}
}
t.Commit();
string message = "Number of Families Renamed: ";
MessageBox.Show(message + count.ToString());
}
}
开发者ID:dannysbentley,项目名称:Family-Rename,代码行数:32,代码来源:changeFamilyNames.cs
示例18: DiagramControl
public DiagramControl()
: base()
{
//double-buffering
SetStyle(ControlStyles.AllPaintingInWmPaint, true);
SetStyle(ControlStyles.DoubleBuffer, true);
SetStyle(ControlStyles.UserPaint, true);
SetStyle(ControlStyles.ResizeRedraw, true);
//init the MVC
Controller = new Controller(this);//the controller will create the model
Controller.OnHistoryChange += new EventHandler<HistoryChangeEventArgs>(mController_OnHistoryChange);
Controller.OnShowSelectionProperties += new EventHandler<SelectionEventArgs>(Controller_OnShowSelectionProperties);
Controller.OnEntityAdded += new EventHandler<EntityEventArgs>(Controller_OnEntityAdded);
Controller.OnEntityRemoved += new EventHandler<EntityEventArgs>(Controller_OnEntityRemoved);
View = Controller.View;
//the diagram document is the total serializable package
Document = new Document(View.Model);
TextEditor.Init(this);
//menu
menu = new ContextMenu();
View.OnCursorChange += new EventHandler<CursorEventArgs>(mView_OnCursorChange);
this.AllowDrop = true;
}
开发者ID:Tom-Hoinacki,项目名称:OO-CASE-Tool,代码行数:28,代码来源:DiagramControl.cs
示例19: DetectionForm
public DetectionForm(Document document, VSProject2 vsProject2, DTE2 dte, IAssemblyDetectionProvider assemblyDetectionProvider)
{
_vsProject2 = vsProject2;
DocumentDetetionService = new DocumentDetetionService(document, vsProject2, dte, assemblyDetectionProvider);
InitializeComponent();
}
开发者ID:nhu,项目名称:RefLoc,代码行数:7,代码来源:DetectionForm.cs
示例20: Window
public Window()
{
InitializeComponent();
//
// document
//
_document = new Document(this);
_document.Width = _innerWidth;
_document.Height = _innerHeight;
this.Children.Add(_document);
element = new Canvas();
//LineGeometry myLineGeometry = new LineGeometry();
//myLineGeometry.StartPoint = new Point(10, 20);
//myLineGeometry.EndPoint = new Point(100, 130);
//Path myPath = new Path();
//myPath.Stroke = Brushes.Black;
//myPath.StrokeThickness = 1;
//myPath.Data = myLineGeometry;
//element.Children.Add(myPath);
//this.Children.Add(element);
this.Loaded += new RoutedEventHandler(Window_Loaded);
//MouseUp += new MouseButtonEventHandler(Window_MouseUp);
}
开发者ID:podlipensky,项目名称:sharpcanvas,代码行数:25,代码来源:Window.xaml.cs
注:本文中的System.Windows.Forms.Document类示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论