本文整理汇总了C#中AODL.Document.TextDocuments.TextDocument.Load方法的典型用法代码示例。如果您正苦于以下问题:C# TextDocument.Load方法的具体用法?C# TextDocument.Load怎么用?C# TextDocument.Load使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类AODL.Document.TextDocuments.TextDocument
的用法示例。
在下文中一共展示了TextDocument.Load方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: MetaDataDisplay
public void MetaDataDisplay()
{
TextDocument document = null;
document = new TextDocument();
document.Load(AARunMeFirstAndOnce.inPutFolder+"ProgrammaticControlOfMenuAndToolbarItems.odt");
Console.WriteLine(document.DocumentMetadata.InitialCreator);
Console.WriteLine(document.DocumentMetadata.LastModified);
Console.WriteLine(document.DocumentMetadata.CreationDate);
Console.WriteLine(document.DocumentMetadata.CharacterCount);
Console.WriteLine(document.DocumentMetadata.ImageCount);
Console.WriteLine(document.DocumentMetadata.Keywords);
Console.WriteLine(document.DocumentMetadata.Language);
Console.WriteLine(document.DocumentMetadata.ObjectCount);
Console.WriteLine(document.DocumentMetadata.PageCount);
Console.WriteLine(document.DocumentMetadata.ParagraphCount);
Console.WriteLine(document.DocumentMetadata.Subject);
Console.WriteLine(document.DocumentMetadata.TableCount);
Console.WriteLine(document.DocumentMetadata.Title);
Console.WriteLine(document.DocumentMetadata.WordCount);
document.DocumentMetadata.SetUserDefinedInfo(UserDefinedInfo.Info1, "Nothing");
Console.WriteLine(document.DocumentMetadata.GetUserDefinedInfo(UserDefinedInfo.Info1));
}
示例2: ODFFrameTest
public void ODFFrameTest()
{
//Create a new text document
TextDocument document = new TextDocument();
document.New();
// Create a main paragraph
Paragraph p =new Paragraph(document);
// Create a main form
ODFForm main_form = new ODFForm(document, "mainform");
main_form.Method = Method.Get;
// Create a frame
ODFFrame frm = new ODFFrame(main_form, p.Content, "frm", "5mm", "5mm", "5cm", "3cm");
frm.Label = "ODFFrame test";
// Add the frame to the form control list
main_form.Controls.Add (frm);
// Create a button
ODFButton butt = new ODFButton(main_form, p.Content, "butt", "1cm", "15mm", "4cm", "1cm");
butt.Label = "A simple button :)";
// Add the button to the form control list
main_form.Controls.Add (butt);
// Add the forms to the document!
document.Forms.Add(main_form);
// Add the paragraph to the content list
document.Content.Add(p);
document.SaveTo(AARunMeFirstAndOnce.outPutFolder+"frame_test.odt");
document.Load(AARunMeFirstAndOnce.outPutFolder+"frame_test.odt");
document.SaveTo(AARunMeFirstAndOnce.outPutFolder+"frame_test2.odt");
}
示例3: ImportTest1
public void ImportTest1 ()
{
string file = AARunMeFirstAndOnce.inPutFolder+"pagestyles.odt";
TextDocument textDocument = new TextDocument();
textDocument.Load(file);
TextMasterPage txtMP = textDocument.TextMasterPageCollection.GetDefaultMasterPage();
Assert.IsNotNull(txtMP, "The default text mast page style must exists.");
}
示例4: HTMLExportTest2
public void HTMLExportTest2()
{
string file = [email protected]"OpenOffice.net.odt";
FileInfo fInfo = new FileInfo(file);
//Load a text document
TextDocument textDocument = new TextDocument();
textDocument.Load(file);
//Save it back again
textDocument.SaveTo(AARunMeFirstAndOnce.outPutFolder+fInfo.Name+".html");
}
示例5: FooterContentsTest
public void FooterContentsTest()
{
string file = AARunMeFirstAndOnce.inPutFolder+"pagestyles.odt";
TextDocument textDocument = new TextDocument();
textDocument.Load(file);
TextMasterPage txtMP = textDocument.TextMasterPageCollection.GetDefaultMasterPage();
Assert.IsNotNull(txtMP.TextPageFooter, "The page header must exist.");
Assert.IsNotNull(txtMP.TextPageFooter.ContentCollection, "Content collection must exist.");
Assert.IsTrue(txtMP.TextPageFooter.ContentCollection.Count > 0, "There must be content in the page footers content collection.");
}
示例6: SimpleTocLoadTest
public void SimpleTocLoadTest()
{
string file = [email protected]"simple_toc.odt";
FileInfo fInfo = new FileInfo(file);
//Load a text document
TextDocument textDocument = new TextDocument();
textDocument.Load(file);
//Save it back again
textDocument.SaveTo(AARunMeFirstAndOnce.outPutFolder+fInfo.Name+".rel.odt");
}
示例7: LoadDocument_With_PageBreak
public void LoadDocument_With_PageBreak()
{
string file = AARunMeFirstAndOnce.inPutFolder + @"paragraph_with_page_break.odt";
TextDocument textDocument = new TextDocument();
textDocument.Load(file);
Assert.AreEqual(3, textDocument.Content.Count);
Paragraph paragraph = textDocument.Content[2] as Paragraph;
Assert.IsNotNull(paragraph);
Assert.AreEqual("page", paragraph.ParagraphStyle.ParagraphProperties.BreakBefore );
}
示例8: LoadGraphichAndSearchForAlternateText
public void LoadGraphichAndSearchForAlternateText()
{
TextDocument document = new TextDocument();
document.Load(AARunMeFirstAndOnce.inPutFolder + "ImageDocument.odt");
Assert.AreEqual(3, document.Content.Count);
Assert.AreEqual(true, document.Content[2] is Paragraph);
Paragraph par = document.Content[2] as Paragraph;
Assert.AreEqual(true, par.Content[0] is Frame);
Frame frame = par.Content[0] as Frame;
Assert.AreEqual("<alternative AODL text>", frame.AlternateText);
}
示例9: SimpleLoadTest
public void SimpleLoadTest()
{
string file = [email protected]"hallo.odt";
FileInfo fInfo = new FileInfo(file);
//Load a text document
TextDocument textDocument = new TextDocument();
textDocument.Load(file);
Assert.IsTrue(textDocument.CommonStyles.Count > 0, "Common Styles must be read!");
Console.WriteLine("Common styles: {0}", textDocument.CommonStyles.Count);
//Save it back again
textDocument.SaveTo(AARunMeFirstAndOnce.outPutFolder+fInfo.Name+".rel.odt");
}
示例10: MetaDataDisplay
public void MetaDataDisplay()
{
TextDocument document = null;
try
{
document = new TextDocument();
document.Load(AARunMeFirstAndOnce.inPutFolder+"ProgrammaticControlOfMenuAndToolbarItems.odt");
}
catch(Exception ex)
{
if(ex is AODLException)
{
if(((AODLException)ex).OriginalException != null)
Console.WriteLine("Org ex: {0}", ((AODLException)ex).OriginalException.Message+"\r\n"
+((AODLException)ex).OriginalException.StackTrace);
if(((AODLException)ex).Node != null)
Console.WriteLine("Node: {0}", ((AODLException)ex).Node.OuterXml);
}
else throw ex;
}
Console.WriteLine(document.DocumentMetadata.InitialCreator);
Console.WriteLine(document.DocumentMetadata.LastModified);
Console.WriteLine(document.DocumentMetadata.CreationDate);
Console.WriteLine(document.DocumentMetadata.CharacterCount);
Console.WriteLine(document.DocumentMetadata.ImageCount);
Console.WriteLine(document.DocumentMetadata.Keywords);
Console.WriteLine(document.DocumentMetadata.Language);
Console.WriteLine(document.DocumentMetadata.ObjectCount);
Console.WriteLine(document.DocumentMetadata.PageCount);
Console.WriteLine(document.DocumentMetadata.ParagraphCount);
Console.WriteLine(document.DocumentMetadata.Subject);
Console.WriteLine(document.DocumentMetadata.TableCount);
Console.WriteLine(document.DocumentMetadata.Title);
Console.WriteLine(document.DocumentMetadata.WordCount);
document.DocumentMetadata.SetUserDefinedInfo(UserDefinedInfo.Info1, "Nothing");
Console.WriteLine(document.DocumentMetadata.GetUserDefinedInfo(UserDefinedInfo.Info1));
}
示例11: StyleTest
public void StyleTest()
{
// Create a new document
TextDocument document = new TextDocument();
document.New();
// Create a main paragraph
Paragraph p =new Paragraph(document);
ParagraphStyle ps1 = new ParagraphStyle(document, "style1");
ps1.Family = "paragraph";
ps1.TextProperties.FontName = FontFamilies.Arial;
ps1.TextProperties.FontColor = AODL.Document.Helper.Colors.GetColor(System.Drawing.Color.Blue);
ps1.TextProperties.Bold = "bold";
ps1.TextProperties.FontSize = "18pt";
document.Styles.Add(ps1);
ParagraphStyle ps2 = new ParagraphStyle(document, "style2");
ps2.Family = "paragraph";
ps2.TextProperties.FontName = FontFamilies.CourierNew;
ps2.TextProperties.Italic = "italic";
ps2.TextProperties.FontSize = "14pt";
ps2.TextProperties.Underline = "dotted";
document.Styles.Add(ps2);
ParagraphStyle ps3 = new ParagraphStyle(document, "style3");
ps3.Family = "paragraph";
ps3.TextProperties.FontName = FontFamilies.Wingdings;
ps3.TextProperties.FontColor = AODL.Document.Helper.Colors.GetColor(System.Drawing.Color.Red);
ps3.TextProperties.FontSize = "16pt";
document.Styles.Add(ps3);
// Create a main form
ODFForm main_form = new ODFForm(document, "mainform");
main_form.Method = Method.Get;
// The first button. It doesn't get a focus on click
ODFButton butt = new ODFButton(main_form, p.Content, "butt1", "0cm", "0mm", "7cm", "1cm");
butt.TextStyle = ps1;
butt.Label = "Button one";
butt.Title = "This button uses Arial font.";
butt.FocusOnClick = XmlBoolean.False;
butt.ButtonType = ButtonType.Push;
main_form.Controls.Add (butt);
// The second button. It is disabled
butt = new ODFButton(main_form, p.Content, "butt2", "0cm", "2cm", "7cm", "1cm");
butt.Label = "Button two";
butt.Title = "Second button.";
butt.FocusOnClick = XmlBoolean.True;
butt.Disabled = XmlBoolean.True;
butt.TextStyle = ps2;
main_form.Controls.Add (butt);
// The third button with "toggle" behaviour
butt = new ODFButton(main_form, p.Content, "butt3", "0cm", "4cm", "7cm", "1cm");
butt.Label = "Button three";
butt.Title = "Third button.";
butt.Toggle = XmlBoolean.True;
butt.TextStyle = ps3;
main_form.Controls.Add (butt);
document.Forms.Add(main_form);
document.Content.Add(p);
document.SaveTo(AARunMeFirstAndOnce.outPutFolder+"style_test.odt");
document.Load(AARunMeFirstAndOnce.outPutFolder+"style_test.odt");
document.SaveTo(AARunMeFirstAndOnce.outPutFolder+"style_test2.odt");
}
示例12: NestedFormTest
public void NestedFormTest()
{
//Create a new text document
TextDocument document = new TextDocument();
document.New();
// Create a main paragraph
Paragraph p =new Paragraph(document);
// Create a main form
ODFForm main_form = new ODFForm(document, "mainform");
ODFForm child_form = new ODFForm(document, "childform");
main_form.Method = Method.Get;
main_form.Method = Method.Get;
// Create a frame
ODFFrame frm = new ODFFrame(main_form, p.Content, "frm", "5mm", "5mm", "5cm", "3cm");
frm.Label = "Main form";
// Add the frame to the form control list
main_form.Controls.Add (frm);
// Create a button
ODFButton butt = new ODFButton(main_form, p.Content, "butt", "1cm", "15mm", "4cm", "1cm");
butt.Label = "This is a main form";
// Add the button to the form control list
main_form.Controls.Add (butt);
// Add the forms to the main form!
document.Forms.Add(main_form);
// Add the paragraph to the content list
document.Content.Add(p);
// adding controls to the nested form
ODFFrame frm_child = new ODFFrame(child_form, p.Content, "frm_child", "5mm", "35mm", "5cm", "3cm");
frm_child.Label = "Child form";
child_form.Controls.Add (frm_child);
ODFButton butt_child = new ODFButton(child_form, p.Content, "butt_child", "1cm", "45mm", "4cm", "1cm");
butt_child.Label = "This is a child form";
child_form.Controls.Add (butt_child);
main_form.ChildForms.Add(child_form);
ODFButton b = document.FindControlById("butt_child") as ODFButton;
Assert.IsNotNull(b, "Error! could not find the specified control");
b.Label = "Child form:)";
// Add the forms to the main form!
document.Forms.Add(main_form);
// Add the paragraph to the content list
document.Content.Add(p);
document.SaveTo(AARunMeFirstAndOnce.outPutFolder+"nested_forms_test.odt");
document.Load(AARunMeFirstAndOnce.outPutFolder+"nested_forms_test.odt");
document.SaveTo(AARunMeFirstAndOnce.outPutFolder+"nested_forms_test2.odt");
}
示例13: SaveLoadTest
public void SaveLoadTest()
{
//Create a new text document
TextDocument document = new TextDocument();
document.New();
Paragraph p =new Paragraph(document);
p.StyleName = "Standard";
ODFForm main_form = new ODFForm(document, "mainform");
main_form.Method = Method.Get;
ODFFrame frm = new ODFFrame(main_form, p.Content, "frm", "5mm", "5mm", "5cm", "3cm");
frm.Label = "Save and Load test";
main_form.Controls.Add (frm);
ODFButton butt = new ODFButton(main_form, p.Content, "butt", "1cm", "15mm", "4cm", "1cm");
butt.Label = "A simple button :)";
main_form.Controls.Add (butt);
document.Forms.Add(main_form);
document.Content.Add(p);
document.SaveTo(AARunMeFirstAndOnce.outPutFolder+"saveload.odt");
document.Load(AARunMeFirstAndOnce.outPutFolder+"saveload.odt");
ODFButton bt = document.FindControlById("butt") as ODFButton;
Assert.IsNotNull(bt, "Could not find control with >butt< ID");
bt.Label = "This label has chanhed";
document.SaveTo(AARunMeFirstAndOnce.outPutFolder+"saveload2.odt");
}
示例14: ODFRadioButtonTest
public void ODFRadioButtonTest()
{
// Create a new document
TextDocument document = new TextDocument();
document.New();
// Create a main paragraph
Paragraph p =new Paragraph(document);
// Create a main form
ODFForm main_form = new ODFForm(document, "mainform");
main_form.Method = Method.Get;
// Create two radio buttons with the same name - they will be in one "group"
ODFRadioButton rb = new ODFRadioButton(main_form, p.Content, "rb1", "0cm", "0mm", "4cm", "5mm");
rb.Label = "Radio Button One";
rb.VisualEffect = VisualEffect.Flat;
rb.CurrentSelected = XmlBoolean.True;
rb.Name = "radio";
main_form.Controls.Add(rb);
rb = new ODFRadioButton(main_form, p.Content, "rb2", "0cm", "1cm", "4cm", "5mm");
rb.Label = "Radio Button Two";
rb.VisualEffect = VisualEffect.ThreeD;
rb.CurrentSelected = XmlBoolean.False;
rb.Name = "radio";
main_form.Controls.Add(rb);
document.Forms.Add(main_form);
document.Content.Add(p);
// Button import/export test
document.SaveTo(AARunMeFirstAndOnce.outPutFolder+"radio_test.odt");
document.Load(AARunMeFirstAndOnce.outPutFolder+"radio_test.odt");
document.SaveTo(AARunMeFirstAndOnce.outPutFolder+"radio_test2.odt");
}
示例15: TextDocumentWithImgMapReload
public void TextDocumentWithImgMapReload()
{
string file = [email protected]"imgmap.odt";
FileInfo fInfo = new FileInfo(file);
//Load the text document
TextDocument document = new TextDocument();
document.Load(file);
IContent iContent = document.Content[2];
Assert.IsNotNull(iContent, "Must exist!");
Assert.IsTrue(iContent is Paragraph, "iContent have to be a paragraph! But is :"+iContent.GetType().Name);
Assert.IsTrue(((Paragraph)iContent).Content[0] is Frame, "Must be a frame! But is :"+((Paragraph)iContent).Content[0].GetType().Name);
Frame frame = ((Paragraph)iContent).Content[0] as Frame;
Assert.IsTrue(frame.Content[1] is ImageMap, "Must be a ImageMap! But is :"+frame.Content[1].GetType().Name);
ImageMap imageMap = frame.Content[1] as ImageMap;
Assert.IsTrue(imageMap.Content[0] is DrawAreaRectangle, "Must be a DrawAreaRectangle! But is :"
+imageMap.Content[0].GetType().Name);
//Save it back again
document.SaveTo(AARunMeFirstAndOnce.outPutFolder+fInfo.Name+".rel.odt");
}