Represent a paragraph within a opendocument document.
Inheritance: IContent, IContentContainer, IHtml, ITextContainer, ICloneable
コード例 #1
0
        private void blank_zakaza_firm(string id_prodaja, string id_kosmetika, string name_kosmetika, string count, string date)
        {
            TextDocument document = new TextDocument();

            document.New();
            AODL.Document.Content.Text.Paragraph p1 = ParagraphBuilder.CreateStandardTextParagraph(document);
            p1.TextContent.Add(new SimpleText(document, "Бланк Заказa. Сетевая косметическая фирма «Бьюти» \n\r"));
            document.Content.Add(p1);

            AODL.Document.Content.Text.Paragraph p2 = ParagraphBuilder.CreateStandardTextParagraph(document);
            p2.TextContent.Add(new SimpleText(document, "Филиал: Ульяновский"));
            document.Content.Add(p2);

            AODL.Document.Content.Text.Paragraph p3 = ParagraphBuilder.CreateStandardTextParagraph(document);
            p3.TextContent.Add(new SimpleText(document, "Номер товара: " + id_kosmetika));
            document.Content.Add(p3);

            AODL.Document.Content.Text.Paragraph p4 = ParagraphBuilder.CreateStandardTextParagraph(document);
            p4.TextContent.Add(new SimpleText(document, "Название товара:" + name_kosmetika));
            document.Content.Add(p4);

            AODL.Document.Content.Text.Paragraph p5 = ParagraphBuilder.CreateStandardTextParagraph(document);
            p5.TextContent.Add(new SimpleText(document, "Количество:" + count));
            document.Content.Add(p5);

            AODL.Document.Content.Text.Paragraph p6 = ParagraphBuilder.CreateStandardTextParagraph(document);
            p6.TextContent.Add(new SimpleText(document, "Дата заказа: " + date));
            document.Content.Add(p6);

            document.SaveTo(id_kosmetika + ".blank_zakaza_firm.odt");
        }
コード例 #2
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");
		}
コード例 #3
0
ファイル: FrameTest.cs プロジェクト: stuzzicadenti/aodl
 public void DrawTextBox()
 {
     //New TextDocument
     TextDocument textdocument = new TextDocument();
     textdocument.New();
     //Standard Paragraph
     Paragraph paragraphOuter = new Paragraph(textdocument, ParentStyles.Standard.ToString());
     //Create Frame for DrawTextBox
     Frame frameOuter = new Frame(textdocument, "frame1");
     //Create DrawTextBox
     DrawTextBox drawTextBox = new DrawTextBox(textdocument);
     //Create a paragraph for the drawing frame
     Paragraph paragraphInner = new Paragraph(textdocument, ParentStyles.Standard.ToString());
     //Create the frame with the Illustration resp. Graphic
     Frame frameIllustration = new Frame(textdocument, "frame2", "graphic1", _imagefile);
     //Add Illustration frame to the inner Paragraph
     paragraphInner.Content.Add(frameIllustration);
     //Add inner Paragraph to the DrawTextBox
     drawTextBox.Content.Add(paragraphInner);
     //Add the DrawTextBox to the outer Frame
     frameOuter.Content.Add(drawTextBox);
     //Add the outer Frame to the outer Paragraph
     paragraphOuter.Content.Add(frameOuter);
     //Add the outer Paragraph to the TextDocument
     textdocument.Content.Add(paragraphOuter);
     //Save the document
     textdocument.SaveTo(_framefile2);
 }
コード例 #4
0
ファイル: FieldsTest.cs プロジェクト: rabidbob/aodl-reloaded
		public void PlaceholderTest()
		{
			// Create a new text document
			TextDocument td = new TextDocument();
			td.New();
            
			// Add paragraph 1 with a text placeholder in it
			Paragraph p1 = new Paragraph(td);
			p1.TextContent.Add(new SimpleText(td, "Insert text here: "));
			Placeholder plch1 = new Placeholder(td, PlaceholderType.Text, "A text placeholder");
			plch1.Value = "Text";
			p1.Content.Add(plch1);
			td.Content.Add(p1);

			// Add paragraph 2 with a text-box placeholder in it
			Paragraph p2 = new Paragraph(td);
			p2.TextContent.Add(new SimpleText(td, "Insert text-box here: "));
			Placeholder plch2 = new Placeholder(td, PlaceholderType.TextBox, "A text-box placeholder");
			plch2.Value = "Text-Box";
			p2.Content.Add(plch2);
			td.Content.Add(p2);

			// Add paragraph 3 with a table placeholder in it
			Paragraph p3 = new Paragraph(td);
			p3.TextContent.Add(new SimpleText(td, "Insert table here: "));
			Placeholder plch3 = new Placeholder(td, PlaceholderType.Table, "A table placeholder");
			plch3.Value = "Table";
			p3.Content.Add(plch3);
			td.Content.Add(p3);

			// Add paragraph 4 with an object placeholder in it
			Paragraph p4 = new Paragraph(td);
			p4.TextContent.Add(new SimpleText(td, "Insert object here: "));
			Placeholder plch4 = new Placeholder(td, PlaceholderType.Object, "An object placeholder");
			plch4.Value = "Object";
			p4.Content.Add(plch4);
			td.Content.Add(p4);

			// Add paragraph 5 with an image placeholder in it
			Paragraph p5 = new Paragraph(td);
			p5.TextContent.Add(new SimpleText(td, "Insert image here: "));
			Placeholder plch5 = new Placeholder(td, PlaceholderType.Image, "An image placeholder");
			plch5.Value = "Image";
			p5.Content.Add(plch5);
			td.Content.Add(p5);

			// test save/load
			td.SaveTo(AARunMeFirstAndOnce.outPutFolder + "placeholder.odt");

			// find a field in the fields collection and change its value
			td.Fields.FindFieldByValue("Image").Value = "There should be an image here";
			
			// test html export!
			td.SaveTo(AARunMeFirstAndOnce.outPutFolder + "placeholder.html");
			td.Load(AARunMeFirstAndOnce.outPutFolder + "placeholder.odt");

			// resave it
            td.SaveTo(AARunMeFirstAndOnce.outPutFolder + "placeholder2.odt");
			
		}
コード例 #5
0
ファイル: Test1.cs プロジェクト: rabidbob/aodl-reloaded
		public  void CreateRowsAndColumns()
		{
			SpreadsheetDocument doc = new SpreadsheetDocument ();
			doc.New ();
			Table table = new Table (doc,"tab1","tab1");
			
			for(int i=1; i<=4; i++)
			{
				for(int j=1; j<=5;j++)
				{
					Cell cell = table.CreateCell ();
					cell.OfficeValueType ="float";
					Paragraph paragraph = new Paragraph (doc);
					string text= (j+i-1).ToString();
					paragraph.TextContent .Add (new SimpleText ( doc,text));
					cell.Content.Add(paragraph);
					cell.OfficeValueType = "string";
					cell.OfficeValue = text;
					
					table.InsertCellAt (i, j, cell);
				}
			}
			
			Assert.AreEqual(5, table.Rows.Count);
			for (int i = 1; i < 4; i++)
			{
				Row row = table.Rows[i];
				Assert.AreEqual(6, row.Cells.Count);
			}
			
		}
コード例 #6
0
		/// <summary>
		/// create the row header of the data table of the chart
		/// </summary>
		/// <param name="table"></param>
		/// <returns></returns>
		private RowHeader CreateRowHeader(Table table)
		{
			RowHeader   rowheader = new RowHeader (table);
			int startColumnIndex = m_tableData.startcell .columnIndex ;
			int endColumnIndex   = m_tableData.endcell .columnIndex ;
			Row  row              = new Row (table);
			Cell cell             = this.CreateNullStringCell (table);
			row.Cells .Add (cell);
			
			for(int i=startColumnIndex; i<=endColumnIndex; i++)
			{
				Cell  tempCell        = new Cell (table.Document);
				tempCell.OfficeValueType ="string";
				Paragraph   paragraph = new Paragraph (m_document);
				string  content       =((char)('A'+i-1)).ToString ()+"ĮŠ";
				paragraph.TextContent .Add (new SimpleText (m_document ,content));
				tempCell.Content .Add (paragraph);
				row.Cells .Add (tempCell);
	
			}
	
			rowheader.RowCollection .Add (row);
	
			return rowheader;
		}
コード例 #7
0
		/// <summary>
		/// 
		/// </summary>
		/// <param name="table"></param>
		/// <returns>the null string cell</returns>
		/// <example ><texp/></example>
		private Cell  CreateNullStringCell(Table table)
		{
			Cell  cell  = new Cell (table.Document);
			Paragraph   paragraph  = new Paragraph (m_document );
			cell.Content .Add (paragraph);
			
			return cell;
		}
コード例 #8
0
		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");
		}
コード例 #9
0
ファイル: Test1.cs プロジェクト: rabidbob/aodl-reloaded
		public  void AutomaticallCreateRows()
		{
			SpreadsheetDocument doc = new SpreadsheetDocument ();
			doc.New ();
			Table table = new Table (doc,"tab1","tab1");
			
			for(int i=1; i<=1; i++)
			{
				for(int j=1; j<=1;j++)
				{
					Cell cell = table.CreateCell ();
					cell.OfficeValueType ="float";
					Paragraph paragraph = new Paragraph (doc);
					string text= (j+i-1).ToString();
					paragraph.TextContent .Add (new SimpleText ( doc,text));
					cell.Content.Add(paragraph);
					cell.OfficeValueType = "string";
					cell.OfficeValue = text;
					
					table.InsertCellAt (i, j, cell);
				}
			}
			
			// test that we have this number of rows and cells
			Assert.AreEqual(2, table.Rows.Count);
			for (int i = 1; i < table.Rows.Count; i++)
			{
				Row row = table.Rows[i];
				Assert.AreEqual(2, row.Cells.Count);
			}
			
			
			// force to insert more cells
			table.InsertCellAt(5, 5, table.CreateCell () );
			
			// assert, that the cells were added
			Assert.AreEqual(6, table.Rows.Count);
			for (int i = 0; i < table.Rows.Count; i++)
			{
				Row row = table.Rows[i];
				Assert.AreEqual(6, row.Cells.Count);
			}
			
		}
コード例 #10
0
ファイル: FieldsTest.cs プロジェクト: rabidbob/aodl-reloaded
		public void SimpleDateFieldTest()
		{
			// Create a new text document
			TextDocument td = new TextDocument();
			td.New();
			// Create a new paragraph
			Paragraph p = new Paragraph(td);
			DateField df = new DateField(td);
			// Set fixed to false whch means that the current date is displayed
			df.Fixed = XmlBoolean.False;
			// add the date field to content
			p.Content.Add(df);
			td.Content.Add(p);
			
			// test import/export
			td.SaveTo(AARunMeFirstAndOnce.outPutFolder + "field_date.odt");
			//td.Load(AARunMeFirstAndOnce.outPutFolder + "field_date.odt");
			//td.Fields.RemoveAt(0);			
			// this document should be empty now!!!
			//td.SaveTo(AARunMeFirstAndOnce.outPutFolder + "field_date2.odt");
		}
コード例 #11
0
		public  void CreateNewChart()
			
		{
			SpreadsheetDocument doc = new SpreadsheetDocument ();
			doc.New ();
			Table table = new Table (doc,"tab1","tab1");
			
			for(int i=1; i<=1; i++)
			{
				for(int j=1; j<=6;j++)
				{
					Cell cell = table.CreateCell ();
					cell.OfficeValueType ="float";
					Paragraph paragraph = new Paragraph (doc);
					string text= (j+i-1).ToString();
					paragraph.TextContent .Add (new SimpleText ( doc,text));
					cell.Content.Add(paragraph);
					cell.OfficeValueType = "string";
					cell.OfficeValue = text;
					table.InsertCellAt (i, j, cell);
				}
			}
			
			Chart chart=ChartBuilder.CreateChartByAxisName
				(table,ChartTypes.bar ,"A1:E4","years","dollars");
			Assert.AreEqual(7, table.Rows[1].Cells.Count);
			Assert.AreEqual(6, table.Rows[2].Cells.Count);
			Assert.AreEqual(6, table.Rows[3].Cells.Count);
			Assert.AreEqual(6, table.Rows[4].Cells.Count);
			/*Chart chart = new Chart (table,"ch1");
			chart.ChartType=ChartTypes.bar .ToString () ;
			chart.XAxisName ="yeer";
			chart.YAxisName ="dollar";
			chart.CreateFromCellRange ("A1:E4");
			chart.EndCellAddress ="tab1.K17";*/
			table.InsertChartAt ("G2",chart);
			
			doc.Content .Add (table);
			doc.SaveTo(Path.Combine(AARunMeFirstAndOnce.outPutFolder, @"NewChartOne.ods"));
		}
コード例 #12
0
        /// <summary>
        /// Converts the paragraph styles.
        /// </summary>
        /// <param name="paragraph">The paragraph.</param>
        /// <param name="paragraphPDF">The paragraph PDF.</param>
        /// <returns>The iText paragraph with converted styles</returns>
        public static ParagraphExt ConvertParagraphStyles(
            AODL.Document.Content.Text.Paragraph paragraph,
            ParagraphExt paragraphPDF)
        {
            try
            {
                if (paragraph.Style != null)
                {
                    if (paragraph.Style is ParagraphStyle &&
                        ((ParagraphStyle)paragraph.Style).ParagraphProperties != null)
                    {
                        paragraphPDF.Alignment = (ParagraphPropertyConverter.GetAlignMent(
                                                      ((ParagraphStyle)paragraph.Style).ParagraphProperties.Alignment));
                    }

                    if (paragraph.Style is ParagraphStyle &&
                        ((ParagraphStyle)paragraph.Style).ParagraphProperties != null &&
                        ((ParagraphStyle)paragraph.Style).ParagraphProperties.BreakAfter != null &&
                        ((ParagraphStyle)paragraph.Style).ParagraphProperties.BreakAfter.ToLower() == "page")
                    {
                        paragraphPDF.PageBreakAfter = true;
                    }

                    if (paragraph.Style is ParagraphStyle &&
                        ((ParagraphStyle)paragraph.Style).ParagraphProperties != null &&
                        ((ParagraphStyle)paragraph.Style).ParagraphProperties.BreakBefore != null &&
                        ((ParagraphStyle)paragraph.Style).ParagraphProperties.BreakBefore.ToLower() == "page")
                    {
                        paragraphPDF.PageBreakBefore = true;
                    }
                }
                return(paragraphPDF);
            }
            catch (Exception)
            {
                throw;
            }
        }
コード例 #13
0
ファイル: ChartTitle.cs プロジェクト: rabidbob/aodl-reloaded
		/// <summary>
		/// Init the title's default text
		/// </summary>

		public void InitTitle()
		{
			Paragraph para = new Paragraph (this.Chart.Document );
			para.TextContent .Add (new SimpleText (this.Document ,"жїБъЬт"));
			this.Content .Add (para);
		}
コード例 #14
0
 public void XLinkTest()
 {
     //Create new TextDocument
     var document		= new TextDocument();
     document.New();
     //Create a new Paragraph
     var para				= new Paragraph(document, "P1");
     //Create some simple text
     var stext			= new SimpleText(document, "Some simple text ");
     //Create a XLink
     var xlink					= new XLink(document, "http://www.sourceforge.net", "Sourceforge");
     //Add the textcontent
     para.TextContent.Add(stext);
     para.TextContent.Add(xlink);
     //Add paragraph to the document content
     document.Content.Add(para);
     //Save
     document.SaveTo(AARunMeFirstAndOnce.outPutFolder+"XLink.odt");
 }
コード例 #15
0
ファイル: TableOfContents.cs プロジェクト: stuzzicadenti/aodl
        /// <summary>
        /// Insert the given text as an Table of contents entry.
        /// e.g. You just insert a Headline 1. My headline to
        /// the document and want this text also as an Table of
        /// contents entry, so you can simply add the text using
        /// this method.
        /// </summary>
        /// <param name="textEntry">The text entry.</param>
        /// <param name="outLineLevel">The outline level possible 1-10.</param>
        public void InsertEntry(string textEntry, int outLineLevel)
        {
            Paragraph paragraph				= new Paragraph(
                ((TextDocument)this.Document), "P1_Toc_Entry"+outLineLevel.ToString());
            ((ParagraphStyle)paragraph.Style).ParentStyle =
                this._contentStyleName+outLineLevel.ToString();
            if(this.UseHyperlinks)
            {
                int firstWhiteSpace			= textEntry.IndexOf(" ");
                System.Text.StringBuilder sb = new System.Text.StringBuilder(textEntry);
                sb							= sb.Remove(firstWhiteSpace, 1);
                string link					= "#"+sb.ToString()+"|outline";
                XLink xlink					= new XLink(this.Document, link, textEntry);
                xlink.XLinkType				= "simple";
                paragraph.TextContent.Add(xlink);
                paragraph.TextContent.Add(new TabStop(this.Document));
                paragraph.TextContent.Add(new SimpleText(this.Document, "1"));
            }
            else
            {
                //add the tabstop and the page number, the number is
                //always set to 1, but will be updated by the most
                //word processors immediately to the correct page number.
                paragraph.TextContent.Add(new SimpleText(this.Document, textEntry));
                paragraph.TextContent.Add(new TabStop(this.Document));
                paragraph.TextContent.Add(new SimpleText(this.Document, "1"));
            }
            //There is a bug which deny to add new simple ta
            //			this.TitleParagraph.ParagraphStyle.ParagraphProperties.TabStopStyleCollection =
            //				this.GetTabStopStyle(TabStopLeaderStyles.Dotted, ".", 16.999);
            paragraph.ParagraphStyle.ParagraphProperties.TabStopStyleCollection =
                this.GetTabStopStyle(TabStopLeaderStyles.Dotted, ".", 16.999);

            this.Content.Add(paragraph);
        }
コード例 #16
0
		public void ODFImageTest()
		{
			//Create a new text document
			TextDocument document = new TextDocument();
			document.New();
			
			// Create a new paragraph
			Paragraph p =new Paragraph(document);
			
			// Create a main form
			ODFForm main_form = new ODFForm(document, "mainform");
			main_form.Method = Method.Get;
			
			// Create an ODFGrid
			ODFImage img = new ODFImage(main_form, p.Content, "grd", "5mm", "5mm", "10cm", "6cm");
			img.ImageData = AARunMeFirstAndOnce.inPutFolder+"Eclipse_add_new_Class.jpg";
			main_form.Controls.Add (img);
			
			document.Forms.Add(main_form);
			document.Content.Add(p);

			document.SaveTo(AARunMeFirstAndOnce.outPutFolder+"image_test.odt");
			document.Load(AARunMeFirstAndOnce.outPutFolder+"image_test.odt");
			document.SaveTo(AARunMeFirstAndOnce.outPutFolder+"image_test2.odt");
		}
コード例 #17
0
		private void BothHasLabels()
		{
			Row    row  = new Row (table);
			Cell   cell = new Cell (table.Document);
			Paragraph  paragraph  = new Paragraph (m_document );
			cell.Content .Add (paragraph);
			row.Cells .Add (cell);
	
			RowHeader   rowheader = new RowHeader (table);
			
			for(int i=startColumnIndex; i<endColumnIndex ; i++)
			{
				Cell cellTemp = m_tableData.table .Rows [startRowIndex-1].Cells[i];
				
				string cellRepeating = cellTemp.ColumnRepeating ;
				
				int  cellRepeated=0;
	
				if (cellRepeating!=null)
					cellRepeated= Int32.Parse (cellTemp.ColumnRepeating);
	
				if (cellRepeated >1)
				{
					for(int j=0; j<cellRepeated-1; j++)
					{
						row.Cells .Add (cellTemp);
						i++;
					}
				}
				
				row.Cells .Add (cellTemp);
	
			}
			
			rowheader.RowCollection .Add (row);
			
			table.RowHeader =rowheader;
	
	
			for(int i=startRowIndex; i<endRowIndex; i++)
				
			{
				Row tempRow = new Row (table);
				for(int j=startColumnIndex-1;j<endColumnIndex;j++)
				{
					Cell  cellTemp = m_tableData.table .Rows [i].Cells [j];
					string cellRepeating = cellTemp.ColumnRepeating;
					int   cellRepeated =0;
					
					if (cellRepeating!=null)
						cellRepeated= Int32.Parse (cellTemp.ColumnRepeating );
	
					if (cellRepeated>1)
						
					{
						for(int m=0; m<cellRepeated-1; m++)
						{
							tempRow.Cells .Add (cellTemp);
							i++;
						}
					}
	
					tempRow.Cells .Add (cellTemp);
				}
				
				table.Rows .Add (tempRow);
			}
		}
コード例 #18
0
		/// <summary>
		/// Creates the paragraph.
		/// </summary>
		/// <param name="paragraphNode">The paragraph node.</param>
		public Paragraph CreateParagraph(XmlNode paragraphNode)
		{
			try
			{
				//Create a new Paragraph
				Paragraph paragraph				= new Paragraph(paragraphNode, this._document);
				//Recieve the ParagraphStyle
				IStyle paragraphStyle			= this._document.Styles.GetStyleByName(paragraph.StyleName);

				if (paragraphStyle != null)
				{
					paragraph.Style				= paragraphStyle;
				}
				else if (paragraph.StyleName != "Standard"
				        && paragraph.StyleName != "Table_20_Contents"
				        && paragraph.StyleName != "Text_20_body"
				        && this._document is TextDocument)
				{
					//Check if it's a user defined style
					IStyle commonStyle			= this._document.CommonStyles.GetStyleByName(paragraph.StyleName);
					if (commonStyle == null)
					{
						this.OnWarning(new AODLWarning(string.Format(
							"A ParagraphStyle '{0}' wasn't found.", paragraph.StyleName), paragraph.Node));
					}
				}

				return this.ReadParagraphTextContent(paragraph);
			}
			catch(Exception ex)
			{
				throw new AODLException("Exception while trying to create a Paragraph.", ex);
			}
		}
コード例 #19
0
		public void FormsClearTest()
		{
			// Create a new document
			TextDocument document	= new TextDocument();
			document.New();
			
			// Create a main paragraph
			Paragraph p =new Paragraph(document);
			p.TextContent.Add(new SimpleText(document, "This document should contain no forms!"));
			
			// 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", "4cm", "1cm");
			butt.Label = "Button one";
			butt.Title = "First button.";
			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", "4cm", "1cm");
			butt.Label = "Button two";
			butt.Title = "Second button.";
			butt.FocusOnClick = XmlBoolean.True;
			butt.Disabled = XmlBoolean.True;
			main_form.Controls.Add (butt);

			// The third button with "toggle" behaviour
			butt = new ODFButton(main_form, p.Content, "butt3", "0cm", "4cm", "4cm", "1cm");
			butt.Label = "Button three";
			butt.Title = "Third button.";
			butt.Toggle = XmlBoolean.True;
			main_form.Controls.Add (butt);

			document.Forms.Add(main_form);
			document.Content.Add(p);

			// Clear all the forms within the document!
			document.Forms.Clear();

			document.SaveTo(AARunMeFirstAndOnce.outPutFolder+"no_forms.odt");
		}
コード例 #20
0
		public void HTMLExportTest()
		{
			//Create a new text document
			TextDocument document					= new TextDocument();
			document.New();
			
			Paragraph p =new Paragraph(document);
			ODFForm main_form = new ODFForm(document, "mainform");
			main_form.Method = Method.Get;
			main_form.Href="http://hello.foo.com";
			
			ODFComboBox	ccb = new ODFComboBox(main_form, p.Content, "ccb", "0mm", "0mm", "3cm", "1cm");
			ccb.Size = 5;
			ccb.DropDown = XmlBoolean.True;
			ccb.Items.Add(new ODFItem(document, "Charlie"));
			ccb.Items.Add(new ODFItem(document, "John"));
			ccb.Items.Add(new ODFItem(document, "Dieter"));
			ccb.Items.Add(new ODFItem(document, "Bill"));
			ccb.Items.Add(new ODFItem(document, "Oleg"));
			ccb.Items.Add(new ODFItem(document, "Lars"));
			main_form.Controls.Add (ccb);
			
			ODFButton butt = new ODFButton(main_form, p.Content, "butt", "5mm", "15mm", "4cm", "1cm");
			butt.Label = "A simple button :)";
			main_form.Controls.Add (butt);

			ODFCheckBox cb = new ODFCheckBox(main_form, p.Content, "cbx", "5mm", "25mm", "4cm", "5mm");
			cb.Label = "check it!";
			cb.Name = "cbx";
			cb.Value = "cbx_value";
			
			main_form.Controls.Add (cb);

			document.Forms.Add(main_form);
			document.Content.Add(p);

			Paragraph text_p = new Paragraph(document);
			text_p.TextContent.Add(new SimpleText(document, "This is a simple text content that is located in the next paragraph after the form!"));
			document.Content.Add(text_p);
			
			document.SaveTo(AARunMeFirstAndOnce.outPutFolder+"html_test.odt");
			document.SaveTo(AARunMeFirstAndOnce.outPutFolder+"html_test.html");
			
		}
コード例 #21
0
		public void ODFValueRangeTest()
		{
			//Create a new text document
			TextDocument document = new TextDocument();
			document.New();
			
			// Create a new paragraph
			Paragraph p =new Paragraph(document);
			
			// Create a main form
			ODFForm main_form = new ODFForm(document, "mainform");
			main_form.Method = Method.Get;
			
			// Create the ODFValueRange as a scroll bar(see the contol implementation)
			ODFValueRange vr= new ODFValueRange(main_form, p.Content, "vr1", "5mm", "5mm", "7cm", "5mm");
			vr.ControlImplementation = "ooo:com.sun.star.form.component.ScrollBar";
			vr.Orientation = Orientation.Horizontal;
			vr.RepeatDelay = "PT0.50S";
			vr.MinValue = 0;
			vr.MaxValue = 100;
            vr.Title = "A scroll bar";
			vr.Properties.Add(new SingleFormProperty(document, PropertyValueType.Boolean, "LiveScroll", "true"));
			main_form.Controls.Add (vr);

			// Create the ODFValueRange as a spin button(see the contol implementation)
			vr= new ODFValueRange(main_form, p.Content, "vr2", "5mm", "2cm", "8mm", "15mm");
			vr.ControlImplementation = "ooo:com.sun.star.form.component.SpinButton";
			vr.Orientation = Orientation.Vertical;
			vr.RepeatDelay = "PT0.50S";
			vr.MinValue = 0;
			vr.MaxValue = 100;
			vr.Title = "A scroll bar";
			main_form.Controls.Add (vr);
			
			document.Forms.Add(main_form);
			document.Content.Add(p);

			document.SaveTo(AARunMeFirstAndOnce.outPutFolder+"valuerange_test.odt");
			document.Load(AARunMeFirstAndOnce.outPutFolder+"valuerange_test.odt");
			document.SaveTo(AARunMeFirstAndOnce.outPutFolder+"valuerange_test2.odt");
		}
コード例 #22
0
		public void GenericPropertiesTest()
		{
			//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");
			
			// add form:properties to the form
			main_form.Properties.Add(new SingleFormProperty(document, PropertyValueType.String, "name", "Oleg Yegorov"));
			main_form.Properties.Add(new SingleFormProperty(document, PropertyValueType.String, "comment", "ODF rulezz!"));
			main_form.Properties.Add(new SingleFormProperty(document, PropertyValueType.Boolean, "some_bool_value", "true"));
			// please check content.xml file to see that they were really added :)

			main_form.Method = Method.Get;
			ODFFrame frm = new ODFFrame(main_form, p.Content, "frm", "5mm", "5mm", "5cm", "7cm");
			frm.Label = "Generic properties test.";
			main_form.Controls.Add (frm);
			
			document.Forms.Add(main_form);
			document.Content.Add(p);

			document.SaveTo(AARunMeFirstAndOnce.outPutFolder+"generic_prop.odt");
		}
コード例 #23
0
		public void ODFListBoxAndComboBoxTest()
		{
			//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", "7cm");
			frm.Label = "List- and ComboBox test";
			main_form.Controls.Add (frm);
			
			ODFListBox lb = new ODFListBox(main_form, p.Content, "lb", "1cm", "15mm", "4cm", "5cm");
			lb.Options.Add(new ODFOption(document, "Charlie"));
			lb.Options.Add(new ODFOption(document, "John"));
			lb.Options.Add(new ODFOption(document, "Dieter"));
			lb.Options.Add(new ODFOption(document, "Bill"));
			lb.Options.Add(new ODFOption(document, "Oleg"));
			lb.Options.Add(new ODFOption(document, "Lars"));
			main_form.Controls.Add (lb);

			ODFComboBox cb = new ODFComboBox(main_form, p.Content, "cb", "1cm", "65mm", "4cm", "6mm");
			cb.Items.Add(new ODFItem(document, "Charlie"));
			cb.Items.Add(new ODFItem(document, "John"));
			cb.Items.Add(new ODFItem(document, "Dieter"));
			cb.Items.Add(new ODFItem(document, "Bill"));
			cb.Items.Add(new ODFItem(document, "Oleg"));
			cb.Items.Add(new ODFItem(document, "Lars"));
			cb.CurrentValue = "Please select a value...";
			cb.DropDown = XmlBoolean.True;

			main_form.Controls.Add (cb);

			document.Forms.Add(main_form);
			document.Content.Add(p);

			document.SaveTo(AARunMeFirstAndOnce.outPutFolder+"listbox_combobox.odt");
		}
コード例 #24
0
		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");
			
		}
コード例 #25
0
ファイル: ChartTitle.cs プロジェクト: rabidbob/aodl-reloaded
		/// <summary>
		/// set the title
		/// </summary>
		/// <param name="styleName"></param>
        
		public void SetTitle(string Title)
		{
			if (this.Content .Count!=0)			  
			{
				 for(int i=0 ;i<this.Content .Count;i++)
				    this.Content .RemoveAt(i);
			}
			Paragraph para = new Paragraph (this.Chart.Document );
			para.TextContent .Add (new SimpleText (this.Document ,Title));
			
			if (this.Chart .Document.IsLoadedFile&&!this.Chart .IsNewed)
			{
				XmlNode node = this.Chart .ChartDoc .ImportNode (para.Node,true );
				this.Node .AppendChild (node);
			}

			else
			{
				this.Content .Add (para);
			}
			
			
		}
コード例 #26
0
        /// <summary>
        /// Gets the picture in OOXMLFormat
        /// </summary>
        /// <param name="doc">The document to add the image to</param>
        /// <param name="index">The index of the image in the list of pargraphs.
        /// This is used for generating an identifier for the image</param>
        /// <param name="imageCount">The number of images in the document.
        ///  This is needed for the caption number</param>
        /// <returns>Picture in OOXML Document</returns>
        public List <AODL.Document.Content.IContent> GetODFParagraph(AODL.Document.TextDocuments.TextDocument doc, int index, ref int imageCount)
        {
            //Create a string with the filename to use.
            //This is the given filename or a temp file if there is only an image.
            string tempFileName = _filePath;

            if (string.IsNullOrEmpty(tempFileName))
            {
                //If there is only an image and not a filepath create a tempfile.
                string dir = string.Format("{0}\\DocumentGenerator", Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData));
                if (!Directory.Exists(dir))
                {
                    Directory.CreateDirectory(dir);
                }
                tempFileName = string.Format("{0}\\Image{1}.jpg", dir, index);
                _image.Save(tempFileName);
            }

            //Create the main paragraph.
            AODL.Document.Content.Text.Paragraph p = ParagraphBuilder.CreateStandardTextParagraph(doc);
            if (!string.IsNullOrEmpty(_text))
            {
                //Draw the text box for the label
                var drawTextBox  = new DrawTextBox(doc);
                var frameTextBox = new AODL.Document.Content.Draw.Frame(doc, "fr_txt_box")
                {
                    DrawName = "fr_txt_box", ZIndex = "0"
                };
                //Create the paragraph for the image
                var pInner = ParagraphBuilder.CreateStandardTextParagraph(doc);
                pInner.StyleName = "Illustration";
                //Create the image frame
                var frame = new AODL.Document.Content.Draw.Frame(doc, "frame1", string.Format("graphic{0}", index), tempFileName)
                {
                    ZIndex = "1"
                };
                //Add the frame.
                pInner.Content.Add(frame);
                //Add the title
                pInner.TextContent.Add(new SimpleText(doc, _text));
                //Draw the text and image in the box.
                drawTextBox.Content.Add(pInner);
                frameTextBox.SvgWidth = frame.SvgWidth;
                drawTextBox.MinWidth  = frame.SvgWidth;
                drawTextBox.MinHeight = frame.SvgHeight;
                frameTextBox.Content.Add(drawTextBox);
                p.Content.Add(frameTextBox);
            }
            else
            {
                //Create a frame with the image.
                var frame = new AODL.Document.Content.Draw.Frame(doc, "Frame1", string.Format("graphic{0}", index), tempFileName);
                p.Content.Add(frame);
            }

            //Finally delete image file if it is a temp file.
            //if (tempFileName != _filePath) File.Delete(tempFileName);

            return(new List <AODL.Document.Content.IContent> {
                p
            });
        }
コード例 #27
0
		/// <summary>
		/// Gets the paragraph as HTML.
		/// </summary>
		/// <param name="paragraph">The paragraph.</param>
		/// <returns></returns>
		public string GetParagraphAsHtml(Paragraph paragraph)
		{
			string html					= "<p ";

			try
			{
				if (paragraph != null)
				{
					if (paragraph.StyleName != null)
						if (paragraph.StyleName != "Text_20_body" 
							&& paragraph.StyleName != "standard"
							&& paragraph.StyleName != "Table_20_body")
						{
							string style	= this.HTMLStyleBuilder.GetParagraphStyleAsHtml(paragraph.ParagraphStyle);							

							if (style.Length > 0)
								html		+= style;//+">\n";
							else
							{
								//Check against a possible common style
								IStyle iStyle		= paragraph.Document.CommonStyles.GetStyleByName(paragraph.StyleName);
								string commonStyle	= "";
								if (iStyle != null && iStyle is ParagraphStyle)
								{
									commonStyle		= this.HTMLStyleBuilder.GetParagraphStyleAsHtml(iStyle as ParagraphStyle);
									if (commonStyle.Length > 0)
										html		+= commonStyle;
									else
										html		= html.Replace(" ", "");
								}
								else
									html		= html.Replace(" ", "");
							}
						}
						else
						{
							html			= html.Replace(" ", "");
						}

					html					+= ">\n";

					string txtstyle	= "<span ";
					bool useTextStyle = false;
					if (paragraph.ParagraphStyle != null)
					{
						string tstyle	= this.HTMLStyleBuilder.GetTextStyleAsHtml(paragraph.ParagraphStyle.TextProperties);
						if (txtstyle.Length > 0)
						{
							txtstyle	+= tstyle+">\n";
							html		+= txtstyle;
							useTextStyle = true;
						}
					}
					else
					{
						//Check again a possible common style
						string commonstyle	= "";
						IStyle iStyle	= paragraph.Document.CommonStyles.GetStyleByName(paragraph.StyleName);
						if (iStyle != null && iStyle is ParagraphStyle)
						{
							commonstyle	= this.HTMLStyleBuilder.GetTextStyleAsHtml(((ParagraphStyle)iStyle).TextProperties);
							if (commonstyle.Length > 0)
							{
								txtstyle	+= commonstyle+">\n";
								html		+= txtstyle;
								useTextStyle = true;
							}
						}
					}

					////
					string mixedCont	= this.GetMixedContentAsHTML(paragraph.MixedContent, paragraph.ParagraphStyle);
			
					////
					if (mixedCont.Length > 0)
						html			+= mixedCont+"&nbsp;";
					else
						html			+= "&nbsp;";

					if (!html.Equals("<p "))
						if (useTextStyle)
							html				+= "</span>\n</p>\n";
						else
							html				+= "</p>\n";
					else
						html				= "";

			if (html.Equals("<p >"))
				html				= "";
				}
			}
			catch(Exception ex)
			{
				throw new AODLException("Exception while trying to build a HTML string from a Heading object.", ex);
			}			

			return html;
		}
コード例 #28
0
        /// <summary>
        /// Converts the specified paragraph.
        /// </summary>
        /// <param name="paragraph">The paragraph.</param>
        /// <returns>The PDF paragraph.</returns>
        public static iTextSharp.text.Paragraph Convert(AODL.Document.Content.Text.Paragraph paragraph)
        {
            try
            {
                iTextSharp.text.Font font;
                if ((ParagraphStyle)paragraph.Style != null &&
                    ((ParagraphStyle)paragraph.Style).TextProperties != null &&
                    ((ParagraphStyle)paragraph.Style).TextProperties.FontName != null)
                {
                    font = TextPropertyConverter.GetFont(
                        ((ParagraphStyle)paragraph.Style).TextProperties);
                }
                else
                {
                    font = DefaultDocumentStyles.Instance().DefaultTextFont;
                }

                ParagraphExt paragraphPDF = new ParagraphExt("", font);
                foreach (object obj in paragraph.MixedContent)
                {
                    if (obj is AODL.Document.Content.Text.FormatedText)
                    {
                        paragraphPDF.Add(FormatedTextConverter.Convert(
                                             obj as AODL.Document.Content.Text.FormatedText));
                    }
                    if (obj is AODL.Document.Content.Text.SimpleText)
                    {
                        paragraphPDF.Add(SimpleTextConverter.Convert(
                                             obj as AODL.Document.Content.Text.SimpleText, font));
                    }
                    else if (obj is AODL.Document.Content.Text.TextControl.TabStop)
                    {
                        paragraphPDF.Add(SimpleTextConverter.ConvertTabs(
                                             obj as AODL.Document.Content.Text.TextControl.TabStop, font));
                    }
                    else if (obj is AODL.Document.Content.Text.TextControl.WhiteSpace)
                    {
                        paragraphPDF.Add(SimpleTextConverter.ConvertWhiteSpaces(
                                             obj as AODL.Document.Content.Text.TextControl.WhiteSpace, font));
                    }
                    else if (obj is AODL.Document.Content.Draw.Frame)
                    {
                        DrawFrameConverter dfc = new DrawFrameConverter();
                        paragraphPDF.Add(dfc.Convert(
                                             obj as AODL.Document.Content.Draw.Frame));
                    }
                    else if (obj is AODL.Document.Content.Draw.Graphic)
                    {
                        ImageConverter ic = new ImageConverter();
                        paragraphPDF.Add(ic.Convert(
                                             obj as AODL.Document.Content.Draw.Graphic));
                    }
                }
                paragraphPDF = ParagraphConverter.ConvertParagraphStyles(paragraph, paragraphPDF);
                // add new line
                paragraphPDF.Add(iTextSharp.text.Chunk.NEWLINE);
                return(paragraphPDF);
            }
            catch (Exception)
            {
                throw;
            }
        }
コード例 #29
0
		/// <summary>
		/// Reads the content of the paragraph text.
		/// </summary>
		/// <param name="paragraph">The paragraph.</param>
		/// <returns></returns>
		private Paragraph ReadParagraphTextContent(Paragraph paragraph)
		{
			try
			{
				if (this._debugMode)
					this.LogNode(paragraph.Node, "Log Paragraph node before");
				
				ArrayList mixedContent			= new ArrayList();
				foreach(XmlNode nodeChild in paragraph.Node.ChildNodes)
				{
					//Check for IText content first
					TextContentProcessor tcp	= new TextContentProcessor();
					IText iText					= tcp.CreateTextObject(this._document, nodeChild.CloneNode(true));
					
					if (iText != null)
						mixedContent.Add(iText);
					else
					{
						//Check against IContent
						IContent iContent		= this.CreateContent(nodeChild);
						
						if (iContent != null)
							mixedContent.Add(iContent);
					}
				}

				//Remove all
				paragraph.Node.InnerXml			= "";

				foreach(Object ob in mixedContent)
				{
					if (ob is IText)
					{
						if (this._debugMode)
							this.LogNode(((IText)ob).Node, "Log IText node read");
						paragraph.TextContent.Add(ob as IText);
					}
					else if (ob is IContent)
					{
						if (this._debugMode)
							this.LogNode(((IContent)ob).Node, "Log IContent node read");
						//paragraph.Content.Add(ob as IContent);
						AddToCollection(ob as IContent, paragraph.Content);
					}
					else
					{
						this.OnWarning(new AODLWarning("Couldn't determine the type of a paragraph child node!.",  paragraph.Node));
					}
				}

				if (this._debugMode)
					this.LogNode(paragraph.Node, "Log Paragraph node after");

				return paragraph;
			}
			catch(Exception ex)
			{
				throw new AODLException("Exception while trying to create the Paragraph content.", ex);
			}
		}
コード例 #30
0
ファイル: DocumentStyles.cs プロジェクト: stuzzicadenti/aodl
        /// <summary>
        /// Inserts the header.
        /// </summary>
        /// <param name="content">The content.</param>
        /// <param name="document">The document.</param>
        internal void InsertHeader(Paragraph content, TextDocument document)
        {
            try
            {
                bool exist			= true;
                XmlNode node		= this._styles.SelectSingleNode("//office:master-styles/style:master-page/style:header", document.NamespaceManager);//
                if(node != null)
                    node.InnerXml	= "";
                else
                {
                    node			= this.CreateNode("header", "style", document);
                    exist			= false;
                }

                XmlNode	impnode		= this.Styles.ImportNode(content.Node, true);
                node.AppendChild(impnode);

                if(!exist)
                    this._styles.SelectSingleNode("//office:master-styles/style:master-page",
                        document.NamespaceManager).AppendChild(node);

                this.InsertParagraphStyle(content, document);
            }
            catch(Exception ex)
            {
                throw;
            }
        }
コード例 #31
0
		/// <summary>
		/// create the row serial cell
		/// </summary>
		/// <param name="table"></param>
		/// <param name="SerialNum"></param>
		/// <returns></returns>
		private Cell  CreateRowSerialCell(Table table,int SerialNum)
		{
			Cell   cell = new Cell (table.Document);
			cell.OfficeValueType ="string";
			Paragraph   paragraph = new Paragraph (m_document);
			string   content      = SerialNum.ToString ()+"ŠŠ";
			paragraph.TextContent .Add (new SimpleText (m_document,content));
			cell.Content .Add (paragraph);
			return cell;
		}
コード例 #32
0
ファイル: DocumentStyles.cs プロジェクト: stuzzicadenti/aodl
        /// <summary>
        /// Inserts the paragraph style.
        /// </summary>
        /// <param name="content">The content.</param>
        /// <param name="document">The document.</param>
        private void InsertParagraphStyle(Paragraph content, TextDocument document)
        {
            try
            {
                if(content.Style != null)
                {
                    XmlNode node		= this.Styles.ImportNode(content.Style.Node, true);
                    this.Styles.SelectSingleNode("//office:styles",
                        document.NamespaceManager).AppendChild(node);
                }

                if(content.TextContent != null)
                    foreach(IText it in content.TextContent)
                        if(it is FormatedText)
                        {
                            XmlNode node		= this.Styles.ImportNode(it.Style.Node, true);
                            this.Styles.SelectSingleNode("//office:styles",
                                document.NamespaceManager).AppendChild(node);
                        }
            }
            catch(Exception ex)
            {
                throw;
            }
        }
コード例 #33
0
		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");
		}
コード例 #34
0
		public void ODFGridTest()
		{
			//Create a new text document
			TextDocument document = new TextDocument();
			document.New();
			
			// Create a new paragraph
			Paragraph p =new Paragraph(document);
			
			// Create a main form
			ODFForm main_form = new ODFForm(document, "mainform");
			main_form.Method = Method.Get;
			
			// Create an ODFGrid
			ODFGrid grd = new ODFGrid(main_form, p.Content, "grd", "5mm", "5mm", "7cm", "5cm");
			grd.Columns.Add(new ODFGridColumn(document, "col1", "One"));
			grd.Columns.Add(new ODFGridColumn(document, "col1", "Two"));
			grd.Columns.Add(new ODFGridColumn(document, "col1", "Three"));
			main_form.Controls.Add (grd);
			
			document.Forms.Add(main_form);
			document.Content.Add(p);

			document.SaveTo(AARunMeFirstAndOnce.outPutFolder+"grid_test.odt");
			document.Load(AARunMeFirstAndOnce.outPutFolder+"grid_test.odt");
			document.SaveTo(AARunMeFirstAndOnce.outPutFolder+"grid_test2.odt");
		}