Inheritance: ODFFormControl
Example #1
0
		public void ODFFixedTextTest()
		{
			//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 three different pieces of text at different positions
			ODFFixedText ft= new ODFFixedText(main_form, p.Content, "ft1", "5mm", "5mm", "5cm", "1cm");
			ft.Label = "Fixed text one";
			ft.Disabled = XmlBoolean.True;
			main_form.Controls.Add (ft);

			ft= new ODFFixedText(main_form, p.Content, "ft2", "15mm", "25mm", "5cm", "1cm");
			ft.Label = "Fixed text two";
			main_form.Controls.Add (ft);

			ft= new ODFFixedText(main_form, p.Content, "ft3", "35mm", "15mm", "5cm", "1cm");
			ft.Label = "Fixed text three";
			main_form.Controls.Add (ft);
			
			document.Forms.Add(main_form);
			document.Content.Add(p);

			document.SaveTo(AARunMeFirstAndOnce.outPutFolder+"fixedtext_test.odt");
			document.Load(AARunMeFirstAndOnce.outPutFolder+"fixedtext_test.odt");
			document.SaveTo(AARunMeFirstAndOnce.outPutFolder+"fixedtext_test2.odt");
		}
Example #2
0
		private void menuItem4_Click(object sender, System.EventArgs e)
		{
			if (saveFileDialog1.ShowDialog() == DialogResult.OK)
			{
				textDocument.New();
				Paragraph p1 = new Paragraph(textDocument);
				p1.TextContent.Add(new SimpleText(textDocument, "This is a test form generated by the ODF Forms demo generator using the AODL library."));

				Paragraph p2 = new Paragraph(textDocument);

				ODFForm fMain = textDocument.AddNewForm("mainform");
			
				ODFFrame frame = new ODFFrame(fMain, p2.Content, "frame", "5mm", "5mm", "9cm", "5cm");
				frame.Label = "Demo Form";
				frame.AnchorType = AnchorType.Paragraph;

				
				ODFFixedText ft_name = new ODFFixedText(fMain, p2.Content, "ft_name", "8mm", "10mm", "3cm", "4mm");
				ft_name.Label = "Name";

				ODFTextArea name = new ODFTextArea(fMain, p2.Content, "name", "8mm", "14mm", "3cm", "5mm");
				name.CurrentValue = eName.Text;
				name.AnchorType = AnchorType.Paragraph;

				ODFFixedText ft_surname = new ODFFixedText(fMain, p2.Content, "ft_surname", "8mm", "20mm", "3cm", "4mm");
				ft_surname.Label = "Surname";

				ODFTextArea surname = new ODFTextArea(fMain, p2.Content, "surname", "8mm", "24mm", "3cm", "5mm");
				surname.CurrentValue = eSurname.Text;
				surname.AnchorType = AnchorType.Paragraph;

				ODFFixedText ft_gender = new ODFFixedText(fMain, p2.Content, "ft_gender", "8mm", "30mm", "3cm", "4mm");
				ft_gender.Label = "Gender";

				ODFListBox gender = new ODFListBox(fMain, p2.Content, "gender", "8mm", "35mm", "3cm", "5mm");
				
				ODFOption male = new ODFOption(textDocument, "Male");
				if (eGender.SelectedIndex == 0)
					male.CurrentSelected = XmlBoolean.True;
				gender.Options.Add(male);
				ODFOption female = new ODFOption(textDocument, "Female");
				if (eGender.SelectedIndex == 1)
					female.CurrentSelected = XmlBoolean.True;
				gender.Options.Add(female);
				gender.AnchorType = AnchorType.Paragraph;
				gender.DropDown = XmlBoolean.True;
				
				ODFFixedText ft_age = new ODFFixedText(fMain, p2.Content, "ft_age", "8mm", "40mm", "3cm", "4mm");
				ft_age.Label = "Age";
				ODFFormattedText age = new ODFFormattedText(fMain, p2.Content, "age", "8mm", "44mm", "3cm", "5mm");
				age.CurrentValue = eAge.Value.ToString();
				age.MinValue = 16;
				age.MaxValue = 100;


				ODFFixedText ft_addinfo= new ODFFixedText(fMain, p2.Content, "ft_addinfo", "45mm", "10mm", "45mm", "4mm");
				ft_addinfo.Label = "Additional information";

				ODFTextArea addinfo = new ODFTextArea(fMain, p2.Content, "addinfo", "45mm", "14mm", "45mm", "25mm");
				addinfo.CurrentValue = eAdditional.Text;
				addinfo.AnchorType = AnchorType.Paragraph;
				addinfo.Properties.Add(new SingleFormProperty(textDocument, PropertyValueType.Boolean, "MultiLine", "true"));

				ODFCheckBox usesaodl = new ODFCheckBox(fMain, p2.Content, "usesaodl", "45mm", "40mm", "45mm", "25mm");
				if (eUsesAODL.Checked)
					usesaodl.CurrentState = State.Checked;
				usesaodl.Label = "This person uses AODL:)";
				usesaodl.AnchorType = AnchorType.Paragraph;
				
				fMain.Controls.Add(frame);
				fMain.Controls.Add(ft_name);
				fMain.Controls.Add(name);
				fMain.Controls.Add(ft_surname);
				fMain.Controls.Add(surname);
				fMain.Controls.Add(ft_gender);
				fMain.Controls.Add(gender);
				fMain.Controls.Add(ft_age);
				fMain.Controls.Add(age);
				fMain.Controls.Add(ft_addinfo);
				fMain.Controls.Add(addinfo);
				fMain.Controls.Add(usesaodl);

				textDocument.Content.Add(p1);
				textDocument.Content.Add(p2);

				textDocument.SaveTo(saveFileDialog1.FileName);
				lastOpenedFile = saveFileDialog1.FileName;
			}
		}