Ejemplo n.º 1
0
        public static string SubmitForm(List <FormData> FormData)
        {
            string messsage = "Sucess";

            try
            {
                BiDocument biDoc = new BiDocument();

                foreach (FormData fd in FormData)
                {
                    Unit u = new Unit();
                    u.ID   = fd.ID;
                    u.Body = fd.Value;
                    biDoc.Units.Add(u);
                }

                using (DocX document = DocX.Create(OutputFileLocation + OutputFileName))
                {
                    foreach (Unit u in biDoc.Units)
                    {
                        Paragraph heading = document.InsertParagraph();
                        heading.Append(u.Body)
                        .Font(new System.Drawing.FontFamily("Calibri"))
                        .FontSize(16)
                        .Color(System.Drawing.Color.Blue);
                        // .Alignment = Alignment.center;
                    }
                    document.Save();
                }
            }
            catch (Exception ex)
            {
            }
            return(messsage);
        }
Ejemplo n.º 2
0
        public static string SubmitForm(List <FormData> FormData)
        {
            string messsage = "Sucess";

            try
            {
                BiDocument biDoc = new BiDocument();

                foreach (FormData fd in FormData)
                {
                    Unit u = new Unit();
                    u.ID   = fd.ID;
                    u.Body = fd.Value;

                    if (fd.TextType == "h")
                    {
                        u.IsHeading = true;
                    }

                    biDoc.Units.Add(u);
                }

                using (DocX document = DocX.Create(OutputFileLocation + OutputFileName))
                {
                    foreach (Unit u in biDoc.Units)
                    {
                        if (!String.IsNullOrEmpty(u.Body))
                        {
                            Paragraph heading = document.InsertParagraph();
                            heading.Append(u.Body)
                            .Font(new System.Drawing.FontFamily("Calibri"));
                            if (u.IsHeading)
                            {
                                heading.FontSize(u.Settings.TitleSize)
                                .Color(System.Drawing.Color.Blue)
                                .SpacingAfter(30);
                            }
                            else
                            {
                                heading.FontSize(u.Settings.ParagraphSize)
                                .Color(System.Drawing.Color.Black)
                                .SpacingAfter(u.Settings.ParaMarginAfter)
                                .SpacingBefore(u.Settings.ParaMarginBefore);
                            }
                            // .Alignment = Alignment.center;
                        }
                    }
                    document.Save();
                }
            }
            catch (Exception ex)
            {
            }
            return(messsage);
        }