示例#1
0
        static void Main(string[] args)
        {
            string inpFile          = @"..\..\example.rtf";
            string outFileInlineCSS = @"Inline CSS.html";
            string outFileClassCSS  = @"Class CSS.html";

            SautinSoft.RtfToHtml r = new SautinSoft.RtfToHtml();

            // Skip images.
            r.ImageStyle.PreserveImages = false;

            try
            {
                r.OpenRtf(inpFile);

                // Specify the title.
                r.TextStyle.Title = "Inline CSS";

                // Generate inline CSS.
                r.TextStyle.InlineCSS = true;

                // Convert to HTML.
                r.ToHtml(outFileInlineCSS);

                // Specify the title.
                r.TextStyle.Title = "Class CSS";

                // Store CSS using the attribute "class".
                r.TextStyle.InlineCSS      = false;
                r.TextStyle.StyleName      = "style";
                r.TextStyle.StartCSSNumber = 100;

                // Convert to HTML.
                r.ToHtml(outFileClassCSS);

                // Open the results for demonstration purposes.
                System.Diagnostics.Process.Start(new System.Diagnostics.ProcessStartInfo(outFileInlineCSS)
                {
                    UseShellExecute = true
                });
                System.Diagnostics.Process.Start(new System.Diagnostics.ProcessStartInfo(outFileClassCSS)
                {
                    UseShellExecute = true
                });
            }
            catch (Exception e)
            {
                Console.WriteLine($"Error: {e.Message}");
                Console.WriteLine("Press any key ...");
                Console.ReadKey();
            }
        }
示例#2
0
        static void Main(string[] args)
        {
            string inpFile = Path.GetFullPath(@"..\..\example.rtf");
            string outFileOriginalFonts = @"Original Fonts.html";
            string outFileSingleFont    = @"Single Font.html";

            SautinSoft.RtfToHtml r = new SautinSoft.RtfToHtml();

            // Skip images.
            r.ImageStyle.PreserveImages = false;

            try
            {
                r.OpenRtf(inpFile);

                // Specify the title.
                r.TextStyle.Title = "Original Fonts";

                // Convert to HTML.
                r.ToHtml(outFileOriginalFonts);

                // Specify the title.
                r.TextStyle.Title = "Single Font";

                // Set single font family, size and color.
                r.TextStyle.FontColor.SetRGB(6, 85, 53);
                r.TextStyle.FontFace = "Verdana";
                r.TextStyle.FontSize = 18;

                // Convert to HTML.
                r.ToHtml(outFileSingleFont);

                // Open the results for demonstration purposes.
                System.Diagnostics.Process.Start(new System.Diagnostics.ProcessStartInfo(outFileOriginalFonts)
                {
                    UseShellExecute = true
                });
                System.Diagnostics.Process.Start(new System.Diagnostics.ProcessStartInfo(outFileSingleFont)
                {
                    UseShellExecute = true
                });
            }
            catch (Exception e)
            {
                Console.WriteLine($"Error: {e.Message}");
                Console.WriteLine("Press any key ...");
                Console.ReadKey();
            }
        }
示例#3
0
        static void Main(string[] args)
        {
            // Read our RTF document as string.
            string inpFile    = @"..\..\example.txt";
            string textString = File.ReadAllText(inpFile);

            string outFile = @"Result.html";

            SautinSoft.RtfToHtml r = new SautinSoft.RtfToHtml();

            // Specify some properties for output HTML document.
            r.OutputFormat    = SautinSoft.RtfToHtml.eOutputFormat.HTML_5;
            r.Encoding        = SautinSoft.RtfToHtml.eEncoding.UTF_8;
            r.TextStyle.Title = "Textual document.";

            try
            {
                r.OpenTextFromString(textString);
                r.ToHtml(outFile);

                // Open the result for demonstration purposes.
                System.Diagnostics.Process.Start(new System.Diagnostics.ProcessStartInfo(outFile)
                {
                    UseShellExecute = true
                });
            }
            catch (Exception e)
            {
                Console.WriteLine($"Error: {e.Message}");
                Console.WriteLine("Press any key ...");
                Console.ReadKey();
            }
        }
示例#4
0
        static void Main(string[] args)
        {
            string inpFile = @"..\..\example.rtf";
            string outFile = @"Title.html";

            SautinSoft.RtfToHtml r = new SautinSoft.RtfToHtml();

            // Set document title, <title>...</title>
            r.TextStyle.Title = "Here is the custom TITLE!";

            // Set the folder to store images
            r.ImageStyle.ImageFolder = Path.GetDirectoryName(Path.GetFullPath(outFile));

            try
            {
                r.OpenRtf(inpFile);
                r.ToHtml(outFile);

                // Open the results for demonstration purposes.
                System.Diagnostics.Process.Start(new System.Diagnostics.ProcessStartInfo(outFile)
                {
                    UseShellExecute = true
                });
            }
            catch (Exception e)
            {
                Console.WriteLine($"Error: {e.Message}");
                Console.WriteLine("Press any key ...");
                Console.ReadKey();
            }
        }
示例#5
0
        static void Main(string[] args)
        {
            string inpFile      = @"..\..\unicode.rtf";
            string outFileNCR   = @"NCR.html";
            string outFileNoNCR = @"Without NCR.html";

            SautinSoft.RtfToHtml r = new SautinSoft.RtfToHtml();

            try
            {
                r.OpenRtf(inpFile);

                // Set to use NCR (Numeric Character Reference), in other words
                // write characters as &#XXXX;
                r.UseNumericCharacterReference = true;
                r.TextStyle.Title = "NCR";
                r.ToHtml(outFileNCR);

                // Don't use NCR, write characters us Unicode (utf-8), like a: på taket är en figur.
                r.UseNumericCharacterReference = false;
                r.TextStyle.Title = "Without NCR";
                r.ToHtml(outFileNoNCR);

                // Open the results for demonstration purposes.
                System.Diagnostics.Process.Start(new System.Diagnostics.ProcessStartInfo(outFileNCR)
                {
                    UseShellExecute = true
                });
                System.Diagnostics.Process.Start(new System.Diagnostics.ProcessStartInfo(outFileNoNCR)
                {
                    UseShellExecute = true
                });
            }
            catch (Exception e)
            {
                Console.WriteLine($"Error: {e.Message}");
                Console.WriteLine("Press any key ...");
                Console.ReadKey();
            }
        }
示例#6
0
        static void Main(string[] args)
        {
            string inpFile            = @"..\..\links.rtf";
            string outFileNotDetected = @"detect false.html";
            string outFileDetected    = @"detect true.html";

            SautinSoft.RtfToHtml r = new SautinSoft.RtfToHtml();

            try
            {
                r.OpenRtf(inpFile);

                // Don't detect hyperlinks from text, convert only real hyperlinks.
                r.TextStyle.HyperlinkDetect = false;
                r.TextStyle.Title           = "HyperlinkDetect = false";
                r.ToHtml(outFileNotDetected);

                // Automatically detect hyperlinks from text.
                r.TextStyle.HyperlinkDetect = true;
                r.TextStyle.HyperlinkTarget = SautinSoft.RtfToHtml.eHyperlinkTarget.Blank;
                r.TextStyle.Title           = "HyperlinkDetect = true";
                r.ToHtml(outFileDetected);

                // Open the results for demonstration purposes.
                System.Diagnostics.Process.Start(new System.Diagnostics.ProcessStartInfo(outFileNotDetected)
                {
                    UseShellExecute = true
                });
                System.Diagnostics.Process.Start(new System.Diagnostics.ProcessStartInfo(outFileDetected)
                {
                    UseShellExecute = true
                });
            }
            catch (Exception e)
            {
                Console.WriteLine($"Error: {e.Message}");
                Console.WriteLine("Press any key ...");
                Console.ReadKey();
            }
        }
示例#7
0
        static void Main(string[] args)
        {
            // Read our DOCX file a bytes array.
            string inpFile = @"..\..\example.docx";

            byte [] rtfBytes = File.ReadAllBytes(inpFile);

            // We'll use the file only for the demonstration.
            string outFile = @"Result.html";

            byte [] htmlBytes = null;

            SautinSoft.RtfToHtml r = new SautinSoft.RtfToHtml();

            // Specify some properties for output HTML document.
            r.OutputFormat = SautinSoft.RtfToHtml.eOutputFormat.HTML_5;
            r.Encoding     = SautinSoft.RtfToHtml.eEncoding.UTF_8;

            // Imagefolder must already exist.
            r.ImageStyle.ImageFolder = System.Environment.CurrentDirectory;

            // Subfolder for images will be created by the component.
            r.ImageStyle.ImageSubFolder = "image.files";

            // A template name for images.
            r.ImageStyle.ImageFileName = "picture";

            // false - store images as files on HDD,
            // true - store images inside HTML document using base64.
            r.ImageStyle.IncludeImageInHtml = false;

            try
            {
                r.OpenDocx(rtfBytes);

                // Here we've got the HTML document as an array of bytes.
                htmlBytes = r.ToHtml();

                // Save our HTML into file and open it for the demonstration purposes.
                File.WriteAllBytes(outFile, htmlBytes);
                System.Diagnostics.Process.Start(new System.Diagnostics.ProcessStartInfo(outFile)
                {
                    UseShellExecute = true
                });
            }
            catch (Exception e)
            {
                Console.WriteLine($"Error: {e.Message}");
                Console.WriteLine("Press any key ...");
                Console.ReadKey();
            }
        }
示例#8
0
        static void Main(string[] args)
        {
            string inpFile       = @"..\..\two paragraphs.rtf";
            string outFileTagP   = @"p.html";
            string outFileTagDiv = @"div.html";

            SautinSoft.RtfToHtml r = new SautinSoft.RtfToHtml();

            try
            {
                r.OpenRtf(inpFile);

                // Set tag <p>...</p> for the paragraphs.
                r.TagStyle.ParagraphTag = SautinSoft.RtfToHtml.eTags.p;
                r.TextStyle.Title       = "P tag";
                r.ToHtml(outFileTagP);

                // Set tag <div>...</div> for the paragraphs.
                r.TagStyle.ParagraphTag = SautinSoft.RtfToHtml.eTags.div;
                r.TextStyle.Title       = "DIV tag";
                r.ToHtml(outFileTagDiv);

                // Open the results for demonstration purposes.
                System.Diagnostics.Process.Start(new System.Diagnostics.ProcessStartInfo(outFileTagP)
                {
                    UseShellExecute = true
                });
                System.Diagnostics.Process.Start(new System.Diagnostics.ProcessStartInfo(outFileTagDiv)
                {
                    UseShellExecute = true
                });
            }
            catch (Exception e)
            {
                Console.WriteLine($"Error: {e.Message}");
                Console.WriteLine("Press any key ...");
                Console.ReadKey();
            }
        }
示例#9
0
        /// <summary>
        /// /
        /// </summary>
        /// <param name="res"></param>
        /// <param name="price"></param>
        /// <param name="payment"></param>
        /// <param name="discount"></param>
        /// <param name="balance"></param>
        /// <param name="FinalAmount"></param>
        /// <returns></returns>
        ///
        public TestResultDto PirntSlip(TestResultDto res, Decimal price, decimal payment, decimal discount, decimal balance, decimal FinalAmount)
        {
            string path = Environment.GetFolderPath(Environment.SpecialFolder.CommonDocuments);

            string fileName = "" + path + "\\paymentSlip.docx";

            var doc = DocX.Create(fileName);

            decimal dis = price * discount;

            doc.InsertParagraph(" _________________________________________________________________________");
            doc.InsertParagraph("                                                                          ");
            doc.InsertParagraph("        LAB REPORT MANAGEMENT SYSTEM  | FINAL PAYEMENT DETAIL             ");
            doc.InsertParagraph(" _________________________________________________________________________");
            doc.InsertParagraph("                                                                          ");
            doc.InsertParagraph("                                                                          ");
            doc.InsertParagraph("    Visit ID         : " + res.VisitID + "                                ");
            doc.InsertParagraph("                                                                          ");
            doc.InsertParagraph("    Test Price       Rs : " + price + "   Payment  Rs : " + payment + "   ");
            doc.InsertParagraph("                                                                          ");
            doc.InsertParagraph("    Discount         Rs : " + dis + "                                     ");
            doc.InsertParagraph("                                                                          ");
            doc.InsertParagraph(" _________________________________________________________________________");
            doc.InsertParagraph("                                                                          ");
            doc.InsertParagraph("    Final Amount  Rs : " + FinalAmount + "                                ");
            doc.InsertParagraph("                                                                          ");
            doc.InsertParagraph("    Balance Rs     Rs : " + balance + "                                   ");
            doc.InsertParagraph("                                                                          ");
            doc.InsertParagraph(" _________________________________________________________________________");
            doc.InsertParagraph("                                                                          ");
            doc.InsertParagraph("                                                                          ");
            doc.InsertParagraph("                                                                          ");

            doc.Save();

            /*Open as html format*/
            SautinSoft.RtfToHtml z = new SautinSoft.RtfToHtml();
            string docxFile        = Path.GetFullPath(fileName);
            string htmlFile        = Path.ChangeExtension(docxFile, ".html");

            z.OpenDocx(docxFile);
            z.ToHtml(htmlFile);
            System.Diagnostics.Process.Start(htmlFile);

            return(null);
        }
示例#10
0
        static void Main(string[] args)
        {
            // Read our RTF document as string.
            string inpFile   = @"..\..\example.rtf";
            string rtfString = File.ReadAllText(inpFile);

            string outFile = @"Result.html";

            SautinSoft.RtfToHtml r = new SautinSoft.RtfToHtml();

            // Specify some properties for output HTML document.
            r.OutputFormat = SautinSoft.RtfToHtml.eOutputFormat.HTML_5;
            r.Encoding     = SautinSoft.RtfToHtml.eEncoding.UTF_8;

            // Imagefolder must already exist.
            r.ImageStyle.ImageFolder = System.Environment.CurrentDirectory;

            // Subfolder for images will be created by the component.
            r.ImageStyle.ImageSubFolder = "image.files";

            // A template name for images.
            r.ImageStyle.ImageFileName = "picture";

            // false - store images as files on HDD,
            // true - store images inside HTML document using base64.
            r.ImageStyle.IncludeImageInHtml = false;

            try
            {
                r.OpenRtf(rtfString);
                r.ToHtml(outFile);

                // Open the result for demonstration purposes.
                System.Diagnostics.Process.Start(new System.Diagnostics.ProcessStartInfo(outFile)
                {
                    UseShellExecute = true
                });
            }
            catch (Exception e)
            {
                Console.WriteLine($"Error: {e.Message}");
                Console.WriteLine("Press any key ...");
                Console.ReadKey();
            }
        }
示例#11
0
        static void Main(string[] args)
        {
            // We'll use the files only for the demonstration,
            // the whole conversion will be done using MemoryStream.
            string inpFile = @"..\..\example.txt";
            string outFile = @"Result.html";

            SautinSoft.RtfToHtml r = new SautinSoft.RtfToHtml();

            // Specify some properties for output HTML document.
            r.OutputFormat    = SautinSoft.RtfToHtml.eOutputFormat.HTML_5;
            r.Encoding        = SautinSoft.RtfToHtml.eEncoding.UTF_8;
            r.TextStyle.Title = "Textual document.";

            try
            {
                using (FileStream textFileStream = new FileStream(inpFile, FileMode.Open))
                {
                    r.OpenText(textFileStream);
                    using (MemoryStream htmlMemoryStream = new MemoryStream())
                    {
                        // Here we've got the HTML document as an array of bytes.
                        r.ToHtml(htmlMemoryStream);

                        // Save our HTML into file and open it for the demonstration purposes.
                        File.WriteAllBytes(outFile, htmlMemoryStream.ToArray());
                        System.Diagnostics.Process.Start(new System.Diagnostics.ProcessStartInfo(outFile)
                        {
                            UseShellExecute = true
                        });
                    }
                }
            }
            catch (Exception e)
            {
                Console.WriteLine($"Error: {e.Message}");
                Console.WriteLine("Press any key ...");
                Console.ReadKey();
            }
        }
示例#12
0
        static void Main(string[] args)
        {
            // Read our RTF file a bytes array.
            string inpFile = @"..\..\example.txt";

            byte[] textBytes = File.ReadAllBytes(inpFile);

            // We'll use the file only for the demonstration.
            string outFile = @"Result.html";

            byte[] htmlBytes = null;

            SautinSoft.RtfToHtml r = new SautinSoft.RtfToHtml();

            // Specify some properties for output HTML document.
            r.OutputFormat    = SautinSoft.RtfToHtml.eOutputFormat.HTML_5;
            r.Encoding        = SautinSoft.RtfToHtml.eEncoding.UTF_8;
            r.TextStyle.Title = "Textual document.";

            try
            {
                r.OpenText(textBytes);

                // Here we've got the HTML document as an array of bytes.
                htmlBytes = r.ToHtml();

                // Save our HTML into file and open it for the demonstration purposes.
                File.WriteAllBytes(outFile, htmlBytes);
                System.Diagnostics.Process.Start(new System.Diagnostics.ProcessStartInfo(outFile)
                {
                    UseShellExecute = true
                });
            }
            catch (Exception e)
            {
                Console.WriteLine($"Error: {e.Message}");
                Console.WriteLine("Press any key ...");
                Console.ReadKey();
            }
        }
示例#13
0
        static void Main(string[] args)
        {
            string inpFile = @"..\..\images.rtf";

            SautinSoft.RtfToHtml r = new SautinSoft.RtfToHtml();

            try
            {
                r.OpenRtf(inpFile);

                // Case "1" - store image as separate *.png files in subfolder "filename.images".
                string outFile = Path.Combine(Directory.GetCurrentDirectory(), "case 1.html");

                // The image folder must be already existed.
                r.ImageStyle.ImageFolder = Path.GetDirectoryName(outFile);

                // If subfolder is not exist, it will be created by the component.
                r.ImageStyle.ImageSubFolder = "case 1.images";

                // A template name for images.
                r.ImageStyle.ImageFileName = "picture";

                // Don't embed images inside HTML document.
                r.ImageStyle.IncludeImageInHtml = false;

                // Assume, that we already have 100 images in the subfolder, let's start to name images from 101.
                r.ImageStyle.ImageNumStart = 101;
                r.ImageStyle.ImagesFormat  = SautinSoft.RtfToHtml.eImageFormat.Png;

                // Case "1" - convert to HTML and Show the result.
                r.TextStyle.Title = "Case 1 - PNG files";
                r.ToHtml(outFile);
                System.Diagnostics.Process.Start(new System.Diagnostics.ProcessStartInfo(outFile)
                {
                    UseShellExecute = true
                });

                // Case "2" - store image as separate *.jpeg files in subfolder "filename.images".
                outFile = Path.Combine(Directory.GetCurrentDirectory(), "case 2.html");
                r.ImageStyle.ImagesFormat = SautinSoft.RtfToHtml.eImageFormat.Jpg;
                r.TextStyle.Title         = "Case 2 - JPEG files";
                r.ToHtml(outFile);
                System.Diagnostics.Process.Start(new System.Diagnostics.ProcessStartInfo(outFile)
                {
                    UseShellExecute = true
                });

                // Case "3" - skip images.
                outFile = Path.Combine(Directory.GetCurrentDirectory(), "case 3.html");
                r.ImageStyle.PreserveImages = false;
                r.TextStyle.Title           = "Case 3 - No images";
                r.ToHtml(outFile);
                System.Diagnostics.Process.Start(new System.Diagnostics.ProcessStartInfo(outFile)
                {
                    UseShellExecute = true
                });

                // Case "4" - embed images inside HTML document using base64.
                outFile = Path.Combine(Directory.GetCurrentDirectory(), "case 4.html");
                r.ImageStyle.PreserveImages     = true;
                r.ImageStyle.IncludeImageInHtml = true;
                r.TextStyle.Title = "Case 4 - Embedded images";
                r.ToHtml(outFile);
                System.Diagnostics.Process.Start(new System.Diagnostics.ProcessStartInfo(outFile)
                {
                    UseShellExecute = true
                });
            }
            catch (Exception ex)
            {
                Console.WriteLine($"Error: {ex.Message}");
                Console.WriteLine("Press any key ...");
                Console.ReadKey();
            }
        }
示例#14
0
        static void Main(string[] args)
        {
            string rtfFile = Path.GetFullPath(@"..\..\images.rtf");

            // 1. Convert RTF to HTML and place all images to list
            string rtfString = File.ReadAllText(rtfFile);

            SautinSoft.RtfToHtml r = new SautinSoft.RtfToHtml();
            r.ImageStyle.IncludeImageInHtml = false;
            List <SautinSoft.RtfToHtml.SautinImage> imageList = new List <SautinSoft.RtfToHtml.SautinImage>();

            // 2. After launching this method we'll get our RTF document in HTML format
            // and list of all images.
            r.OpenRtf(rtfString);
            string htmlString = String.Empty;

            r.ToHtml(out htmlString, imageList);

            // 3. Create HTML email
            string from    = "*****@*****.**";
            string to      = "*****@*****.**";
            string subject = "This is a testing email from Bob to John using SmtpClient";

            MailMessage emailMessage = new MailMessage();

            emailMessage.From = new MailAddress(from);
            emailMessage.To.Add(to);
            emailMessage.Subject = subject.Replace("\r\n", "");

            // 4. Attach images to email
            System.Net.Mail.AlternateView altView = AlternateView.CreateAlternateViewFromString(htmlString, null, "text/html");

            foreach (SautinSoft.RtfToHtml.SautinImage simg in imageList)
            {
                if (simg.Img != null)
                {
                    LinkedResource         lr = null;
                    System.IO.MemoryStream ms = new System.IO.MemoryStream();
                    simg.Img.Save(ms, System.Drawing.Imaging.ImageFormat.Png);
                    if (ms != null && ms.Position > 0)
                    {
                        ms.Position = 0;
                    }
                    lr           = new LinkedResource(ms);
                    lr.ContentId = simg.Cid;
                    altView.LinkedResources.Add(lr);
                }
            }
            emailMessage.AlternateViews.Add(altView);

            // 5. Send the message using email account
            string userName     = "******";
            string userPassword = "******";

            SmtpClient client = new SmtpClient();

            client.Port           = 25;
            client.DeliveryMethod = SmtpDeliveryMethod.Network;

            //client.UseDefaultCredentials = false;

            // Some smtp servers doesn't require credentials, therefore
            // you may set: client.UseDefaultCredentials = false;
            // and remove the line: client.Credentials = new NetworkCredential(userName, userPassword);

            client.Credentials = new NetworkCredential(userName, userPassword);
            client.Host        = "smtpout.bobsite.com";

            // In the real example in case of the correct host, uncomment the line below:
            //client.Send(emailMessage);
            Console.WriteLine("The message has been sent!");
            Console.ReadKey();
        }
示例#15
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="printreport"></param>
        /// <returns></returns>
        public TestResultDto PrintReport(TestResultDto printreport)
        {
            MapperConfig.ConfigAutoMapper();



            if (printreport != null)
            {
                int patientid = visit.GetVisit(printreport.VisitID).PatientID;
                var patient   = base.context.Patients.AsNoTracking().FirstOrDefault(p => p.PatientId.Equals(patientid));

                String name    = patient.Name;
                int    age     = patient.Age;
                string sex     = patient.Gender;
                string address = patient.Address;
                string number  = patient.ContactNo;

                DateTime arrivedate = visit.GetVisit(printreport.VisitID).ArriveDate;
                DateTime ExpDelDate = visit.GetVisit(printreport.VisitID).ExpectedDeliveryDate;

                int TesTID       = test.GetTest(printreport.VisitID).TemplateID;
                var testTemplate = base.context.TestTemplates.FirstOrDefault(p => p.TestTemplateId.Equals(TesTID));


                string  templatename = testTemplate.TemplateName;
                int     temID        = testTemplate.TestTemplateId;
                decimal price        = testTemplate.Price;


                IList <TestResultDto>            results = resultSet.GetTestResults(printreport.VisitID);
                IList <TestTemplateAttributeDto> Attribs = VisitHelper.GetTestTemplateAttributes(temID);
                string path     = Environment.GetFolderPath(Environment.SpecialFolder.CommonDocuments);
                string fileName = "" + path + "\\Report.docx";

                var doc = DocX.Create(fileName);

                doc.InsertParagraph(" __________________________________________________________________________________________________                                  ");
                doc.InsertParagraph("");
                doc.InsertParagraph("                      MEDICAL LAB REPORT MANAGEMENT SYSTEM  |  FINAL TEST REPORT ");
                doc.InsertParagraph("");
                doc.InsertParagraph(" __________________________________________________________________________________________________                                  ");
                doc.InsertParagraph("                                                                                                                                     ");
                doc.InsertParagraph("                                                                                                                                     ");
                doc.InsertParagraph("     Patient Name : " + name + "                                    Gender : " + sex + "                                             ");
                doc.InsertParagraph("                                                                                                                                     ");
                doc.InsertParagraph("                                                                                                                                     ");
                doc.InsertParagraph("     Patient Age : " + age + "                                                        Address:" + address + "   Payment : RS: " + price + "");
                doc.InsertParagraph("                                                                                                                                     ");
                doc.InsertParagraph("                                                                                                                                     ");
                doc.InsertParagraph("     Contact Number : " + number + "                                    Test : " + templatename + "                                  ");
                doc.InsertParagraph("                                                                                                                                     ");
                doc.InsertParagraph("");

                doc.InsertParagraph("     Arrived Date: " + arrivedate + "                      Deliver Date:" + ExpDelDate + "                                           ");
                doc.InsertParagraph("                                                                                                                                     ");
                doc.InsertParagraph(" __________________________________________________________________________________________________                                  ");

                doc.InsertParagraph("");
                doc.InsertParagraph("     Patients Results ");
                doc.InsertParagraph("");
                doc.InsertParagraph("");

                int seq = 1;
                foreach (var x in results)
                {
                    doc.InsertParagraph("     " + seq + "           Value: " + x.Value + "              Status : " + x.Status + "");
                    doc.InsertParagraph("");
                    seq++;

                    if (seq > Attribs.Count)
                    {
                        break;
                    }
                }

                doc.InsertParagraph("");
                doc.InsertParagraph("");
                doc.InsertParagraph("    Reffer below Information. ");
                doc.InsertParagraph("");
                doc.InsertParagraph("");

                int NextSeq = 1;
                foreach (var x in Attribs)
                {
                    doc.InsertParagraph("     " + NextSeq + " . " + x.Attribute + " --> " + x.PrefferedLimit + "");
                    doc.InsertParagraph("");
                    doc.InsertParagraph("");
                    NextSeq++;
                }

                doc.Save();

                /*Open as html format*/
                SautinSoft.RtfToHtml z = new SautinSoft.RtfToHtml();
                string docxFile        = Path.GetFullPath(fileName);
                string htmlFile        = Path.ChangeExtension(docxFile, ".html");

                z.OpenDocx(docxFile);
                z.ToHtml(htmlFile);
                System.Diagnostics.Process.Start(htmlFile);

                return(null);
            }

            else
            {
                throw new ArgumentNullException("Provided information is not valid.");
            }
        }