Esempio n. 1
0
        private Paragraph AddUserInformationParagraphs(Section io_section)
        {
            const string dateFormat    = "d/M/yyyy";
            const string space         = "0.5cm";
            const int    fontSize      = 12;
            const int    titleFontSize = 20;
            Color        red           = Color.FromRgb(139, 0, 0);
            const char   colon         = ':';

            try
            {
                Type          typeOfMe = m_UI.GetType();
                FormattedText baseInformationTitleStyle = null;
                string        date = DateTime.Now.ToString(dateFormat);
                Paragraph     UserInformationParagraph = io_section.AddParagraph(date);

                foreach (PropertyInfo propInfo in typeOfMe.GetProperties())
                {
                    UserInformationParagraph = io_section.AddParagraph();
                    UserInformationParagraph.Format.SpaceBefore = space;
                    UserInformationParagraph.Format.Font.Size   = fontSize;
                    object fieldValue = propInfo.GetValue(m_UI, null);
                    string fieldName  = propInfo.Name;

                    baseInformationTitleStyle       = UserInformationParagraph.AddFormattedText(fieldName, TextFormat.Underline);
                    baseInformationTitleStyle.Color = red;
                    baseInformationTitleStyle.Size  = titleFontSize;
                    baseInformationTitleStyle.AddChar(colon);
                    UserInformationParagraph.AddLineBreak();
                    UserInformationParagraph.AddFormattedText(fieldValue as string, TextFormat.Bold);
                }

                return(UserInformationParagraph);
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }