public void AppendHeader(TNaglowek naglowek, string nip) { var headerBigFont = new XFont(DefaultValues.Groupbox.Font.FontFamily.Name, 12, XFontStyle.Bold, DefaultValues.Groupbox.Font.PdfOptions); var nipContent = new GroupBox(0, _document.Width * 3 / 4, "") { MarginLeft = 0, MarginTop = 0, MarginRight = 0, MarginBottom = 0 }; var percentRowWidths = new[] { 45, 35, 20 }; var rowControls = new[] { new InputBox(Resources.InputTitle1, nip), new InputBox(Resources.InputTitle2) {Brush = XBrushes.LightGray}, new InputBox(Resources.InputTitle3) {Brush = XBrushes.LightGray}, }; nipContent.AddRow(rowControls, percentRowWidths); _document.AddContainer(nipContent); var miesiacVal = naglowek.DateType == ItemChoiceType.Miesiac ? naglowek.Miesiac.ToString() : ""; var kwartalVal = naglowek.ItemElementName == ItemChoiceType.Kwartal ? naglowek.Kwartal.ToString() : ""; var titleContent = new GroupBox(0, _document.Width, "") { MarginBottom = 10, Brush = new XSolidBrush(XColor.FromArgb(128, 128, 255)), Controls = new List<IControl> { new Label(20, 0, Resources.TitleLabel1) {Font = headerBigFont}, new Label(150, 0, Resources.TitleLabel2) {Font = headerBigFont}, new Label(270, 50, Resources.TitleLabel3) {Font = headerBigFont}, new InputBox(new XRect(200, 40, 60, 30), Resources.InputTitle4, miesiacVal), new InputBox(new XRect(300, 40, 60, 30), Resources.InputTitle5, kwartalVal), new InputBox(new XRect(400, 40, 80, 30), Resources.InputTitle6, naglowek.Rok) } }; _document.AddContainer(titleContent); var infoFont = new XFont(DocumentContainer.FontFamily, 8); var infoContent = new GroupBox(0, _document.Width, "") { MarginLeft = 5, MarginTop = 1, MarginRight = 1, MarginBottom = 1, Controls = new List<IControl> { new Label(0, 0, Resources.InfoContent0Label) {Font = infoFont}, new Label(0, 10, Resources.InfoContent1Label) {Font = infoFont}, new Label(0, 40, Resources.InfoContent2Label) {Font = infoFont}, new Label(0, 50, Resources.InfoContent3Label) {Font = infoFont}, new Label(new XRect(80, 0, _document.Width, 50), Resources.InfoContent0Label){Font = infoFont}, new Label(new XRect(80, 10, _document.Width, 50), Resources.InfoContent1Value){Font = infoFont}, new Label(new XRect(80, 40, _document.Width, 50), Resources.InfoContent2Value){Font = infoFont}, new Label(new XRect(80, 50, _document.Width, 70), Resources.InfoContent3Value){Font = infoFont}, } }; _document.AddContainer(infoContent); }
public static void Sample1(string fileName) { var deklaracja = new Deklaracja(); var naglowek = new TNaglowek { CelZlozenia = 3, Rok = DateTime.Now.Year.ToString(), WariantFormularza = 2, KodUrzedu = TKodUS.Item1813, KodFormularza = new TNaglowekKodFormularza(), Item = 8, ItemElementName = ItemChoiceType.Miesiac }; var podmiot = new DeklaracjaPodmiot1 { OsobaFizyczna = new TIdentyfikatorOsobyFizycznej { DataUrodzenia = DateTime.Now, ImiePierwsze = "Bartosz", Nazwisko = "Frąckowiak", NIP = "123-456-32-18", PESEL = "89082606238" }, AdresZamieszkaniaSiedziby = new TPodmiotDowolnyAdresZamieszkaniaSiedziby { AdresPolski = new TAdresPolski { Gmina = "Bydgoszcz", KodKraju = TKodKraju.PL, KodPocztowy = "85-200", Miejscowosc = "Bydgoszcz", NrDomu = "33", NrLokalu = "3", Poczta = "Polska", Powiat = "Bydgoski", Ulica = "Łokietka 33", Wojewodztwo = "Kuj-Pom" } }, }; var pozycjeSzczegulowe = new PozycjeSzczegolowe { Grupa1 = new List<Grupa1> { new Grupa1 {P_Da = TKodKrajuUE.EE, P_Db = "a", P_Dc = 2, P_Dd = 2}, new Grupa1 {P_Da = TKodKrajuUE.CY, P_Db = "b", P_Dc = 3, P_Dd = 3} }, Grupa2 = new List<Grupa2> { new Grupa2 {P_Na = TKodKrajuUE.ES, P_Nb = "c", P_Nc = 4, P_Nd = 4}, new Grupa2 {P_Na = TKodKrajuUE.EE, P_Nb = "c", P_Nc = 5, P_Nd = 5} }, Grupa3 = new List<Grupa3> { new Grupa3 {P_Ua = TKodKrajuUE.IT, P_Ub = "e", P_Uc = 6}, new Grupa3 {P_Ua = TKodKrajuUE.ES, P_Ub = "f", P_Uc = 7} } }; deklaracja.Podmiot1 = podmiot; deklaracja.PozycjeSzczegolowe = pozycjeSzczegulowe; deklaracja.SetOswiadczenie(); deklaracja.Naglowek = naglowek; deklaracja.SaveToFile(fileName); }
public static bool LoadFromFile(string fileName, out TNaglowek obj) { System.Exception exception = null; return LoadFromFile(fileName, out obj, out exception); }
public static bool LoadFromFile(string fileName, out TNaglowek obj, out System.Exception exception) { return LoadFromFile(fileName, Encoding.UTF8, out obj, out exception); }
/// <summary> /// Deserializes xml markup from file into an TNaglowek object /// </summary> /// <param name="fileName">string xml file to load and deserialize</param> /// <param name="obj">Output TNaglowek object</param> /// <param name="exception">output Exception value if deserialize failed</param> /// <returns>true if this XmlSerializer can deserialize the object; otherwise, false</returns> public static bool LoadFromFile(string fileName, System.Text.Encoding encoding, out TNaglowek obj, out System.Exception exception) { exception = null; obj = default(TNaglowek); try { obj = LoadFromFile(fileName, encoding); return true; } catch (System.Exception ex) { exception = ex; return false; } }
public static bool Deserialize(string xml, out TNaglowek obj) { System.Exception exception = null; return Deserialize(xml, out obj, out exception); }
/// <summary> /// Deserializes workflow markup into an TNaglowek object /// </summary> /// <param name="xml">string workflow markup to deserialize</param> /// <param name="obj">Output TNaglowek object</param> /// <param name="exception">output Exception value if deserialize failed</param> /// <returns>true if this XmlSerializer can deserialize the object; otherwise, false</returns> public static bool Deserialize(string xml, out TNaglowek obj, out System.Exception exception) { exception = null; obj = default(TNaglowek); try { obj = Deserialize(xml); return true; } catch (System.Exception ex) { exception = ex; return false; } }