AODL.Document.TextDocuments.TextDocument.SaveTo C# (CSharp) Method

SaveTo() public method

Save the TextDocument as OpenDocument textdocument.
public SaveTo ( string filename ) : void
filename string The filename. With or without full path. Without will save the file to application path!
return void
		public void SaveTo(string filename)
		{
			try
			{
				//Build document first
				foreach(string font in this.FontList)
					this.AddFont(font);
				this.CreateContentBody();

				//Call the ExportHandler for the first matching IExporter
				ExportHandler exportHandler		= new ExportHandler();
				IExporter iExporter				= exportHandler.GetFirstExporter(
					DocumentTypes.TextDocument, filename);
				iExporter.Export(this, filename);
			}
			catch(Exception)
			{
				throw;
			}
		}

Same methods

TextDocument::SaveTo ( string filename, IExporter iExporter ) : void

Usage Example

示例#1
0
		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");
		}
All Usage Examples Of AODL.Document.TextDocuments.TextDocument::SaveTo