当前位置: 首页>>代码示例>>C#>>正文


C# List.Clear方法代码示例

本文整理汇总了C#中iTextSharp.text.List.Clear方法的典型用法代码示例。如果您正苦于以下问题:C# List.Clear方法的具体用法?C# List.Clear怎么用?C# List.Clear使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在iTextSharp.text.List的用法示例。


在下文中一共展示了List.Clear方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: AutoResizeTableColumns

        /// <summary>
        /// Tries to auto resize the specified table columns.
        /// </summary>
        /// <param name="table">pdf table</param>
        public static void AutoResizeTableColumns(this PdfGrid table)
        {
            if (table == null) return;
            var currentRowWidthsList = new List<float>();
            var previousRowWidthsList = new List<float>();

            foreach (var row in table.Rows)
            {
                currentRowWidthsList.Clear();
                currentRowWidthsList.AddRange(row.GetCells().Select(cell => cell.GetCellWidth()));

                if (!previousRowWidthsList.Any())
                {
                    previousRowWidthsList = new List<float>(currentRowWidthsList);
                }
                else
                {
                    for (int i = 0; i < previousRowWidthsList.Count; i++)
                    {
                        if (previousRowWidthsList[i] < currentRowWidthsList[i])
                            previousRowWidthsList[i] = currentRowWidthsList[i];
                    }
                }
            }

            if (previousRowWidthsList.Any())
                table.SetTotalWidth(previousRowWidthsList.ToArray());
        }
开发者ID:VahidN,项目名称:PdfReport,代码行数:32,代码来源:ElementsWidth.cs

示例2: getNums

        static List<int> getNums(string input_text)
        {
            char[] delChars = { ',' };

            List<string> str_pages = new List<string>(input_text.Split(delChars));
            List<int> pages = new List<int>();

            foreach (string s in str_pages)
            {
                Match match = Regex.Match(s, @"^[0-9]+$");

                if (match.Success)
                {
                    pages.Add(Int32.Parse(s));
                }

            }

            foreach (string t in str_pages)
            {
                Match match = Regex.Match(t, @"^\d+-+\d+$");

                if (match.Success)
                {
                    int num1 = sep(t, "before");
                    int num2 = sep(t, "after");

                    if (num1 >= num2)
                    {
                        // FAIL PROCESS, ALERT USER
                        pages.Clear();
                        return pages;
                    }
                    else
                    {
                        foreach (int num in Enumerable.Range(num1, num2 - num1 + 1))
                        {
                            pages.Add(num);
                        }
                    }
                }
            }

            return pages;
        }
开发者ID:cbaze19,项目名称:bazepdf,代码行数:45,代码来源:Form1.cs

示例3: CreateReport

        public void CreateReport(string filepath, int scene_number, EyeX.Person person)
        {
            var doc = new Document();

            // Set the page size
            doc.SetPageSize(PageSize.A4.Rotate());
            string fullpath= Path.Combine(filepath, "report.pdf");
            PdfWriter.GetInstance(doc, new FileStream(fullpath, FileMode.Create));

            doc.Open();

            // add personal info
            List<Phrase> phrases = new List<Phrase>();
            phrases.Add(new Phrase(Properties.Settings.Default.id + "\n", HeaderFont));
            phrases.Add(new Phrase("Персональная информация \n", HeaderFont));
            phrases.Add(new Phrase("Возраст: " + person.age + "\n", ArticleFont));
            phrases.Add(new Phrase("Пол: " + person.sex.ToString() + "\n", ArticleFont));
            phrases.Add(new Phrase("Дата: " + DateTime.Now.ToString() + "\n", ArticleFont));
            phrases.Add(new Phrase("\n", ArticleFont));

            foreach (var phrase in phrases)
                doc.Add(phrase);
            phrases.Clear();

            for (int i = 0; i < scene_number; i++)
            {
                Image img = Image.GetInstance(filepath + "\\img\\" + i + ".jpeg");

                img.ScalePercent(50);
                img.Alignment = Element.ALIGN_CENTER;
                doc.Add(img);
            }

            doc.Close();
            Process.Start(filepath);
        }
开发者ID:osin-vladimir,项目名称:EyeX,代码行数:36,代码来源:ReportHelper.cs

示例4: insertarCodigosDeBarraAPlantillaWord

        private void insertarCodigosDeBarraAPlantillaWord(Word.Document docPRUEBA, int i)
        {
            List<Word.Shape> lst = new List<Word.Shape>();
            foreach (Word.Shape sh in docPRUEBA.Shapes)
            {
                while (sh.Name.Contains("\n"))
                    sh.Name = sh.Name.Replace("\n", "");
                if (sh.Type.ToString() == "msoPicture")
                    lst.Add(sh);
            }
            List<Word.Range> ranges = new List<Microsoft.Office.Interop.Word.Range>();

            float left, top, h, w;
            bool insertado = false;
            string tempname = "";
            List<Word.Shape> removedShapes = new List<Word.Shape>();
            try
            {
                foreach (string bcd in lista_camposCodBarr)
                {
                    insertado = false;
                    ranges.Clear();
                    foreach (Word.Shape sh in lst)
                    {
                        if (sh.Name == bcd)
                        {
                            left = sh.Left;
                            top = sh.Top;
                            h = sh.Height;
                            w = sh.Width;
                            sh.ConvertToInlineShape();
                            foreach (Word.InlineShape s in docPRUEBA.InlineShapes)
                            {
                                if (s.Type == Word.WdInlineShapeType.wdInlineShapePicture)
                                {
                                    tempname = sh.Name;
                                    ranges.Add(s.Range);
                                    s.Delete();
                                    removedShapes.Add(sh);
                                }
                            }
                            foreach (Word.Range r in ranges)
                            {
                                r.InlineShapes.AddPicture(@rutasEnModAdmin.RutaDeTemp + "/" + i + bcd + ".jpg", Type.Missing, Type.Missing, Type.Missing);
                                insertado = true;
                            }
                            Word.Shape pic;
                            foreach (Word.InlineShape s in docPRUEBA.InlineShapes)
                            {
                                if (s.Type == Word.WdInlineShapeType.wdInlineShapePicture)
                                {
                                    pic = s.ConvertToShape();
                                    pic.Name = tempname;
                                    pic.Top = top;
                                    pic.Left = left;
                                    pic.Height = h;
                                    pic.Width = w;
                                }
                            }
                            if (insertado)
                                break;
                        }

                    }
                    foreach (Word.Shape s in removedShapes)
                        lst.Remove(s);
                }
                if (dgv_PesosLotes.InvokeRequired)
                {
                    this.Invoke(new Action(() => dgv_PesosLotes.Rows[i].DefaultCellStyle.BackColor = Color.White));
                    this.Invoke(new Action(() => dgv_PesosLotes.Rows[i].Cells[1].ReadOnly = false ));
                    this.Invoke(new Action(() => dgv_PesosLotes.Rows[i].Cells[2].ReadOnly = false));
                    this.Invoke(new Action(() => dgv_PesosLotes.Rows[i].Cells[4].ReadOnly = false));
                    this.Invoke(new Action(() => dgv_PesosLotes.Rows[i].Cells[5].ReadOnly = false));

                }
                else
                {
                    dgv_PesosLotes.Rows[i].DefaultCellStyle.BackColor = Color.White;
                    dgv_PesosLotes.Rows[i].Cells[1].ReadOnly = false;
                    dgv_PesosLotes.Rows[i].Cells[2].ReadOnly = false;
                    dgv_PesosLotes.Rows[i].Cells[4].ReadOnly = false;
                    dgv_PesosLotes.Rows[i].Cells[5].ReadOnly = false;
                }
            }
            catch
            {
                if (dgv_PesosLotes.InvokeRequired)
                {
                    this.Invoke(new Action(() => dgv_PesosLotes.Rows[i].DefaultCellStyle.BackColor = Color.Red));
                    this.Invoke(new Action(() => dgv_PesosLotes.Rows[i].Cells[3].Value = null));
                    this.Invoke(new Action(() => dgv_PesosLotes.Rows[i].Cells[1].ReadOnly = false));
                    this.Invoke(new Action(() => dgv_PesosLotes.Rows[i].Cells[2].ReadOnly = false));
                    this.Invoke(new Action(() => dgv_PesosLotes.Rows[i].Cells[4].ReadOnly = false));
                    this.Invoke(new Action(() => dgv_PesosLotes.Rows[i].Cells[5].ReadOnly = false));
                }
                else
                {
                    dgv_PesosLotes.Rows[i].DefaultCellStyle.BackColor = Color.Red;
                    dgv_PesosLotes.Rows[i].Cells[3].Value = null;
//.........这里部分代码省略.........
开发者ID:GeMaths,项目名称:etiquetasPMM,代码行数:101,代码来源:EtiquetasPedidosMostrador.cs

示例5: insertarCodigosDeBarraAPlantillaWord_ParaCopiar

        private void insertarCodigosDeBarraAPlantillaWord_ParaCopiar(Word.Document docWord)
        {
            int i = 0;
            List<Word.Shape> lst = new List<Word.Shape>();
            foreach (Word.Shape sh in docWord.Shapes)
            {
                while (sh.Name.Contains("\n"))
                    sh.Name = sh.Name.Replace("\n", "");
                if (sh.Type.ToString() == "msoPicture")
                    lst.Add(sh);
            }
            List<Word.Range> ranges = new List<Microsoft.Office.Interop.Word.Range>();

            float left, top, h, w;
            bool insertado = false;
            string tempname = "";
            List<Word.Shape> removedShapes = new List<Word.Shape>();
            try
            {
                foreach (string bcd in lista_camposCodBarr)
                {
                    insertado = false;
                    ranges.Clear();
                    foreach (Word.Shape sh in lst)
                    {
                        if (sh.Name == bcd)
                        {
                            left = sh.Left;
                            top = sh.Top;
                            h = sh.Height;
                            w = sh.Width;
                            sh.ConvertToInlineShape();
                            foreach (Word.InlineShape s in docWord.InlineShapes)
                            {
                                if (s.Type == Word.WdInlineShapeType.wdInlineShapePicture)
                                {
                                    tempname = sh.Name;
                                    ranges.Add(s.Range);
                                    s.Delete();
                                    removedShapes.Add(sh);
                                }
                            }
                            foreach (Word.Range r in ranges)
                            {
                                r.InlineShapes.AddPicture(@rutasEnModAdmin.RutaDeTemp + "/" + i + bcd + ".jpg", Type.Missing, Type.Missing, Type.Missing);
                                insertado = true;
                            }
                            Word.Shape pic;
                            foreach (Word.InlineShape s in docWord.InlineShapes)
                            {
                                if (s.Type == Word.WdInlineShapeType.wdInlineShapePicture)
                                {
                                    pic = s.ConvertToShape();
                                    pic.Name = tempname;
                                    pic.Top = top;
                                    pic.Left = left;
                                    pic.Height = h;
                                    pic.Width = w;
                                }
                            }
                            if (insertado)
                                break;
                        }

                    }
                    foreach (Word.Shape s in removedShapes)
                        lst.Remove(s);
                }
            }
            catch(Exception ex)
            {
                MessageBox.Show(ex.Message);
            }

        }
开发者ID:GeMaths,项目名称:etiquetasPMM,代码行数:75,代码来源:EtiquetasPedidosMostrador.cs

示例6: ICS109

        public ActionResult ICS109(Guid id)
        {
            var mission = this.db.Missions.Include("Log").Single(f => f.Id == id);

              string pdfTemplate = Server.MapPath(Url.Content("~/Content/forms/ics109-log.pdf"));

              using (MemoryStream result = new MemoryStream())
              {
            iTextSharp.text.Document resultDoc = new iTextSharp.text.Document();
            PdfCopy copy = new PdfCopy(resultDoc, result);
            resultDoc.Open();

            Queue<Tuple<string, string, string>> rows = null;
            int numPages = -1;
            int totalRows = 0;
            int page = 1;

            List<string> operators = new List<string>();

            do
            {
              using (MemoryStream filledForm = new MemoryStream())
              {
            iTextSharp.text.pdf.PdfReader pdfReader = new iTextSharp.text.pdf.PdfReader(pdfTemplate);
            //// create and populate a string builder with each of the
            //// field names available in the subject PDF

            //StringBuilder sb = new StringBuilder();
            //foreach (var de in pdfReader.AcroFields.Fields)
            //{
            //    sb.Append(de.Key.ToString() + Environment.NewLine);
            //}
            //// Write the string builder's content to the form's textbox

            using (MemoryStream buf = new MemoryStream())
            {
              PdfStamper stamper = new PdfStamper(pdfReader, buf);

              var fields = stamper.AcroFields;

              if (rows == null)
              {
                rows = Fill109Rows(mission.Log.OrderBy(f => f.Time), fields, "topmostSubform[0].Page1[0].SUBJECTRow1[0]");
                totalRows = rows.Count;
              }

              foreach (var field in fields.Fields)
              {
                fields.SetField(field.Key, "");
              }

              int currentRow = 1;
              operators.Clear();
              while (rows.Count > 0 && fields.GetField("topmostSubform[0].Page1[0].SUBJECTRow" + currentRow.ToString() + "[0]") != null)
              {
                var row = rows.Dequeue();

                fields.SetField("topmostSubform[0].Page1[0].TIMERow" + currentRow.ToString() + "[0]", row.Item1);
                fields.SetField("topmostSubform[0].Page1[0].SUBJECTRow" + currentRow.ToString() + "[0]", row.Item2);

                if (!operators.Contains(row.Item3)) operators.Add(row.Item3);
                currentRow++;
              }

              // Now we know how many rows on a page. Figure out how many pages we need for all rows.
              if (numPages < 0)
              {
                int rowsPerPage = currentRow - 1;
                int remainder = totalRows % currentRow;
                numPages = ((remainder == 0) ? 0 : 1) + (totalRows / currentRow);
              }

              if (numPages > 0)
              {
                fields.SetField("topmostSubform[0].Page1[0]._1_Incident_Name[0]", "   " + mission.Title);
                fields.SetField("topmostSubform[0].Page1[0]._3_DEM_KCSO[0]", "    " + mission.StateNumber);
                fields.SetField("topmostSubform[0].Page1[0]._5_RADIO_OPERATOR_NAME_LOGISTICS[0]", string.Join(",", operators.Distinct()));
                fields.SetField("topmostSubform[0].Page1[0].Text30[0]", string.Format("{0:yyyy-MM-dd}", mission.Log.DefaultIfEmpty().Min(f => (f == null) ? (DateTime?)null : f.Time)));
                fields.SetField("topmostSubform[0].Page1[0].Text31[0]", string.Format("{0:yyyy-MM-dd}", mission.Log.DefaultIfEmpty().Max(f => (f == null) ? (DateTime?)null : f.Time)));
                fields.SetField("topmostSubform[0].Page1[0].Text28[0]", page.ToString());
                fields.SetField("topmostSubform[0].Page1[0].Text29[0]", numPages.ToString());
                fields.SetField("topmostSubform[0].Page1[0].DateTime[0]", DateTime.Now.ToString("     MMM d, yyyy  HH:mm"));
                fields.SetField("topmostSubform[0].Page1[0]._8_Prepared_by_Name[0]", Strings.DatabaseName);

                fields.RemoveField("topmostSubform[0].Page1[0].PrintButton1[0]");
              }

              stamper.FormFlattening = false;
              stamper.Close();

              pdfReader = new PdfReader(buf.ToArray());
              copy.AddPage(copy.GetImportedPage(pdfReader, 1));
              page++;
            }
              }
              //copy.Close();
            } while (rows != null && rows.Count > 0);

            resultDoc.Close();
            return File(result.ToArray(), "application/pdf", mission.StateNumber + "_ICS109_CommLog.pdf");
//.........这里部分代码省略.........
开发者ID:mattkur,项目名称:KCSARA-Database,代码行数:101,代码来源:MissionsController_Documents.cs

示例7: Split

        public void Split(string pdfPath, string destPath, BackgroundWorker worker = null)
        {
            //Inicjalizacja raportowania
            if (this.ReportCheckBox.Checked) {
                this.logsFile = new StreamWriter(Path.Combine(destPath, DateTime.Now.ToString("yyyyMMddHHmmss") + "RAPORT.txt"));
            }

            #region Wstępne rozpoznawanie

            BitmapPDF pdfBitmap = new BitmapPDF(pdfPath);
            PdfReader pdfDoc = new PdfReader(pdfPath);

            int[] results = new int[pdfDoc.NumberOfPages];
            for (int i = 0; i < pdfDoc.NumberOfPages && !worker.CancellationPending; i++) {
                try {
                    results[i] = pdfBitmap.Current.AvgContent;
                    if (logsFile != null) {
                        logsFile.WriteLine(String.Format("Strona {0}: {1}", i + 1, results[i]));
                    }

                    worker.ReportProgress(((i + 1) * 100) / pdfDoc.NumberOfPages);
                    pdfBitmap.MoveNext();
                } catch (Exception ex) {
                    //Będzie zawsze na końcu
                    Console.WriteLine(ex.Message);
                }
            }

            pdfDoc.Close();
            pdfBitmap.Dispose();
            if (logsFile != null)
                logsFile.Close();
            #endregion

            #region Właściwe rozdzielanie
            if (!worker.CancellationPending) {
                int j = 1;
                List<int> pages = new List<int>();

                foreach (int result in results) {
                    if (result > int.Parse(Properties.Settings.Default.MaxSensitivity)) {
                        if (pages.Count > 0) {
                            try {
                                string pdfDest = Path.Combine(destPath, DateTime.Now.ToString("yyyyMMddHHmmss") + j.ToString().PadLeft(4, '0') + ".pdf");
                                this.ExtractPages(pdfPath, pdfDest, pages.ToArray());
                            } catch (Exception ex) {
                                MessageBox.Show("Wystąpił błąd! " + ex.Message, "To jakiś straszny błąd!", MessageBoxButtons.OK, MessageBoxIcon.Error);
                            }

                            pages.Clear();
                        }
                    } else if (result > int.Parse(Properties.Settings.Default.MinSensitivity)) {
                        pages.Add(j);
                    }

                    j++;
                }

                //Na wszelki wypadek, gdyby końcówka została
                if (pages.Count > 0) {
                    try {
                        string pdfDest = Path.Combine(destPath, DateTime.Now.ToString("yyyyMMddHHmmss") + j.ToString().PadLeft(4, '0') + ".pdf");
                        this.ExtractPages(pdfPath, pdfDest, pages.ToArray());
                    } catch (Exception ex) {
                        MessageBox.Show("Wystąpił błąd! " + ex.Message, "To jakiś straszny błąd!", MessageBoxButtons.OK, MessageBoxIcon.Error);
                    }
                }
            }
            #endregion

            worker.ReportProgress(0);
        }
开发者ID:KolololoPL,项目名称:PDFManager,代码行数:72,代码来源:PDFSplitter.cs

示例8: EndElement

        /**
         * Checks for
         * {@link com.itextpdf.tool.xml.css.CSS.Property#PAGE_BREAK_AFTER}, if the
         * value is always a <code>Chunk.NEXTPAGE</code> is added to the
         * currentContentList after calling
         * {@link AbstractTagProcessor#end(Tag, List)}.
         */

        public IList<IElement> EndElement(IWorkerContext ctx, Tag tag, IList<IElement> currentContent)
        {
            IList<IElement> list = new List<IElement>();
            if (currentContent.Count == 0)
            {
                list = End(ctx, tag, currentContent);
            }
            else
            {
                IList<IElement> elements = new List<IElement>();
                foreach (IElement el in currentContent)
                {
                    if (el is Chunk && ((Chunk) el).HasAttributes() &&
                        ((Chunk) el).Attributes.ContainsKey(Chunk.NEWPAGE))
                    {
                        if (elements.Count > 0)
                        {
                            IList<IElement> addedElements = End(ctx, tag, elements);
                            foreach (IElement addedElement in addedElements)
                            {
                                list.Add(addedElement);
                            }
                            elements.Clear();
                        }
                        list.Add(el);
                    }
                    else
                    {
                        elements.Add(el);
                    }
                }
                if (elements.Count > 0)
                {
                    IList<IElement> addedElements = End(ctx, tag, elements);
                    foreach (IElement addedElement in addedElements)
                    {
                        list.Add(addedElement);
                    }
                    elements.Clear();
                }
            }
            String pagebreak;
            if (tag.CSS.TryGetValue(CSS.Property.PAGE_BREAK_AFTER, out pagebreak) && Util.EqualsIgnoreCase(CSS.Value.ALWAYS, pagebreak))
            {
                list.Add(Chunk.NEXTPAGE);
            }
            return list;
        }
开发者ID:jagruti23,项目名称:itextsharp,代码行数:56,代码来源:AbstractTagProcessor.cs

示例9: printRingForUser

        private void printRingForUser(UserShows userShow, int UserID, Document doc, ref List<int> defaultUsers, ref int pageCount)
        {
            float[] ringColumns = new float[] { 300, 300, 300, 300 };

            User currentUser = new User(userShow.Userid);
            Shows show = new Shows(userShow.ShowID);

            List<ShowDetails> showDetailsList = ShowDetails.GetShowDetails(userShow.ShowID);

            Rings r = new Rings();
            DataSet ringList = r.GetAllRingsForShow(userShow.ShowID, "ShowDate");

            Dogs d = new Dogs();

            DogClasses dc = new DogClasses();
            DateTime dt = DateTime.Now;
            string currentJudge = "";
            int currentRingID = 0;
            int ShowDetailsID = -1;
            int PrevShowDetailsID = -1;
            PdfPTable rings = new PdfPTable(ringColumns);

            int ringCnt = 0;
            PdfPCell cell = null;
            PdfPTable ringDetails = null;
            PdfPTable classDetailsTable = null;
            List<int> dogsRunningToday = new List<int>();
            PdfPTable headerPage = null;
            List<TeamPairsTrioDto> pairsTeams = new List<TeamPairsTrioDto>();
            try
            {
                foreach (DataRow ringRow in ringList.Tables[0].Rows)
                {
                    Rings ring = new Rings(ringRow);
                    int RingID = Convert.ToInt32(ringRow["RingID"]);
                    int EntryType = Convert.ToInt32(ringRow["EntryType"]);
                    int Lho = Convert.ToInt32(ringRow["Lho"]);
                    ShowDetailsID = Convert.ToInt32(ringRow["ShowDetailsID"]);

                    if (ringRow.IsNull("ClassID"))
                    {
                        continue;
                    }
                    int ClassID = Convert.ToInt32(ringRow["ClassID"]);
                    int ClassNo = Convert.ToInt32(ringRow["ClsNo"]);
                    DateTime rowDT = Convert.ToDateTime(ringRow["ShowDate"]);
                    if (rowDT != dt)
                    {
                        if (currentRingID != 0)
                        {
                            if (ringCnt % MaxColumns != 0)
                            {
                                var remind = ringCnt % MaxColumns;
                                while (remind-- > 0)
                                {
                                    cell = new PdfPCell(new Phrase(new Chunk(" ", pageFont)));
                                    cell.BorderWidth = 0;
                                    rings.AddCell(cell);
                                }
                            }
                            if (dogsRunningToday.Count() > 0 || UserID == -1)
                            {
                                doc.Add(headerPage);
                                doc.Add(rings);
                                if (UserID > -1)
                                {
                                    if (currentUser.UserID != UserID)
                                    {
                                        User defaultHandler = new User(UserID);
                                    }
                                }

                                doc.NewPage();
                                pageCount++;
                            }
                        }

                        dogsRunningToday.Clear();
                        if (UserID > -1)
                        {
                            if (currentUser.UserID == UserID)
                            {
                                headerPage = DrawHeader(show, rowDT, currentUser, userShow);
                            }
                            else
                            {
                                User defaultHandler = new User(UserID);
                                headerPage = DrawHeader(show, rowDT, defaultHandler, userShow);
                            }
                        }
                        else
                        {
                            headerPage = DrawHeader(show, rowDT, null, null);

                        }
                        dt = rowDT;
                        rings = new PdfPTable(ringColumns);
                        rings.WidthPercentage = 100;
                        ringCnt = 0;
                    }
//.........这里部分代码省略.........
开发者ID:woofwoof88,项目名称:first-place-processing,代码行数:101,代码来源:RunningPlans.cs

示例10: insertarPrimerosCodigosDeBarra

        private void insertarPrimerosCodigosDeBarra(bool EtiquetaMultiples)
        {
            this.generarPrimerosCodigosDeBarra(true);
            List<string> bcdUsados = new List<string>();
            foreach (Etiqueta_C.Estructura_etqMultiple etqM in ListaEtiquetasMultiples)
            {
                string path = @rutasEnModAdmin.RutaDePlantillas + "/temp_EtiquetaActual" + ListaEtiquetasMultiples.IndexOf(etqM) + ".docx";
                appWord.DisplayAlerts = Word.WdAlertLevel.wdAlertsNone;
                appWord.Visible = false;

                doc = appWord.Documents.Open(path);
                List<Word.Shape> lst = new List<Word.Shape>();

                foreach (Word.Shape sh in doc.Shapes)
                {
                    if (sh.Type.ToString() == "msoPicture")
                    {
                        while (sh.Name.Contains("\n"))
                            sh.Name = sh.Name.Replace("\n", "");
                        lst.Add(sh);
                    }
                }
                foreach (string bcd in lista_camposCodBarr)
                {
                    foreach (Control txt in gb_CamposAdicionales.Controls.OfType<TextBox>())
                    {
                        if (!txt.Name.Contains(bcd.Replace("bcd", "")))
                            continue;
                        try
                        {
                            bcdUsados.Add(bcd);
                            float left, top, h, w;
                            string tempname = "";
                            List<Word.Range> ranges = new List<Word.Range>();
                            Word.Shape removed = null;
                            foreach (Word.Shape sh in lst)
                            {
                                if (sh.Name == bcd)
                                {
                                    left = sh.Left;
                                    top = sh.Top;
                                    h = sh.Height;
                                    w = sh.Width;
                                    sh.ConvertToInlineShape();
                                    foreach (Word.InlineShape s in doc.InlineShapes)
                                    {
                                        if (s.Type == Word.WdInlineShapeType.wdInlineShapePicture)
                                        {
                                            tempname = sh.Name;
                                            ranges.Add(s.Range);
                                            s.Delete();
                                            removed = sh;
                                        }
                                    }
                                    foreach (Word.Range r in ranges)
                                    {
                                        if (File.Exists(@rutasEnModAdmin.RutaDeTemp + "/" + bcd + ".jpg"))
                                            r.InlineShapes.AddPicture(@rutasEnModAdmin.RutaDeTemp + "/" + bcd + ".jpg", Type.Missing, Type.Missing, Type.Missing);
                                    }
                                    ranges.Clear();
                                    Word.Shape pic;
                                    foreach (Word.InlineShape s in doc.InlineShapes)
                                    {
                                        if (s.Type == Word.WdInlineShapeType.wdInlineShapePicture)
                                        {
                                            pic = s.ConvertToShape();
                                            pic.Name = tempname;
                                            pic.Top = top;
                                            pic.Left = left;
                                            pic.Height = h;
                                            pic.Width = w;
                                        }
                                    }
                                }
                                
                            }
                            lst.Remove(removed);
                        }
                        catch (Exception ex)
                        {
                            MessageBox.Show(ex.Message + "\n\n" + ex.ToString());
                        }
                    }
                }
                doc.Save();
                doc.Saved = true;
                ((Microsoft.Office.Interop.Word._Document)doc).Close();
                
            }
            foreach (string str in bcdUsados)
                lista_camposCodBarr.Remove(str);

        }
开发者ID:GeMaths,项目名称:etiquetasPMM,代码行数:93,代码来源:EtiquetasCaja.cs

示例11: insertarCodigosDeBarraAWordMasDeUnaEtq

        private void insertarCodigosDeBarraAWordMasDeUnaEtq(Word.Document doc, int indice ,int etqActual, bool nuevaHoja)
        {
            bool continuar = false;
            while (!continuar)
            {
                if (indice == 0)
                    continuar = true;
                else
                {
                    if (dgv_PesosLotes.Rows[indice - 1].DefaultCellStyle.BackColor == Color.Orange
                        && (indice % 2 != 0 || indice == 1))
                        continuar = false;
                    else
                        continuar = true;
                }
            }

            List<Word.Shape> lst = new List<Word.Shape>();
            foreach (Word.Shape sh in doc.Shapes)
            {
                while (sh.Name.Contains("\n"))
                    sh.Name = sh.Name.Replace("\n", "");
                if (sh.Type.ToString() == "msoPicture")
                    lst.Add(sh);
            }


            List<Word.Range> ranges = new List<Microsoft.Office.Interop.Word.Range>();
            float left, top, h, w;
            bool insertado = false;
            string tempname = "";
            List<Word.Shape> removedShapes = new List<Word.Shape>();
            try
            {
                foreach (string bcd in lista_camposCodBarr)
                {
                    insertado = false;
                    ranges.Clear();
                    foreach (Word.Shape sh in lst)
                    {
                        if (sh.Name == bcd + etqActual)
                        {
                            left = sh.Left;
                            top = sh.Top;
                            h = sh.Height;
                            w = sh.Width;
                            sh.ConvertToInlineShape();
                            foreach (Word.InlineShape s in doc.InlineShapes)
                            {
                                if (s.Type == Word.WdInlineShapeType.wdInlineShapePicture)
                                {
                                    tempname = sh.Name;
                                    ranges.Add(s.Range);
                                    s.Delete();
                                    removedShapes.Add(sh);
                                }
                            }
                            foreach (Word.Range r in ranges)
                            {
                                r.InlineShapes.AddPicture(@rutasEnModAdmin.RutaDeTemp + "/" + indice + bcd + ".jpg", Type.Missing, Type.Missing, Type.Missing);
                                insertado = true;
                            }
                            Word.Shape pic;
                            ranges.Clear();
                            foreach (Word.InlineShape s in doc.InlineShapes)
                            {
                                if (s.Type == Word.WdInlineShapeType.wdInlineShapePicture)
                                {
                                    pic = s.ConvertToShape();
                                    pic.Name = tempname;
                                    pic.Top = top;
                                    pic.Left = left;
                                    pic.Height = h;
                                    pic.Width = w;
                                }
                            }
                            if (insertado)
                                break;
                        }
                    }
                    foreach (Word.Shape s in removedShapes)
                        lst.Remove(s);
                    
                }
                if (dgv_PesosLotes.InvokeRequired)
                {
                    this.Invoke(new Action(() => dgv_PesosLotes.Rows[indice].DefaultCellStyle.BackColor = Color.White));
                    this.Invoke(new Action(() => dgv_PesosLotes.Rows[indice].Cells[1].ReadOnly = false));
                    this.Invoke(new Action(() => dgv_PesosLotes.Rows[indice].Cells[2].ReadOnly = false));
                    this.Invoke(new Action(() => dgv_PesosLotes.Rows[indice].Cells[4].ReadOnly = false));
                    this.Invoke(new Action(() => dgv_PesosLotes.Rows[indice].Cells[5].ReadOnly = false));
                    this.Invoke(new Action(() => dgv_PesosLotes.Rows[indice].Cells[6].ReadOnly = false));
                }
                else
                {
                    dgv_PesosLotes.Rows[indice].DefaultCellStyle.BackColor = Color.White;
                    dgv_PesosLotes.Rows[indice].Cells[1].ReadOnly = false;
                    dgv_PesosLotes.Rows[indice].Cells[2].ReadOnly = false;
                    dgv_PesosLotes.Rows[indice].Cells[4].ReadOnly = false;
                    dgv_PesosLotes.Rows[indice].Cells[5].ReadOnly = false;
//.........这里部分代码省略.........
开发者ID:GeMaths,项目名称:etiquetasPMM,代码行数:101,代码来源:EtiquetasCaja.cs

示例12: insertarCodigosDeBarraAWord

        private void insertarCodigosDeBarraAWord(Word.Document doc)
        {
            try
            {
                bool x = this.generarCodigosDeBarra();
                List<Word.Shape> lst = new List<Word.Shape>();
                List<Word.Range> ranges = new List<Microsoft.Office.Interop.Word.Range>();

                float left, top, h, w;
                bool insertado = false;
                string tempname = "";

                foreach (CamposCodigos bcds in ListaCodigos)
                {
                    insertado = false;
                    ranges.Clear();
                    foreach (Word.Shape sh in doc.Shapes)
                    {
                        if (sh.Type.ToString() == "msoPicture")
                        {
                            sh.Name = sh.Name.Trim();
                            if (sh.Name == bcds.nombrecodigo)
                            {
                                left = sh.Left;
                                top = sh.Top;
                                h = sh.Height;
                                w = sh.Width;
                                sh.ConvertToInlineShape();
                                foreach (Word.InlineShape s in doc.InlineShapes)
                                {
                                    if (s.Type == Word.WdInlineShapeType.wdInlineShapePicture)
                                    {
                                        tempname = sh.Name;
                                        ranges.Add(s.Range);
                                        s.Delete();
                                    }
                                }
                                foreach (Word.Range r in ranges)
                                {
                                    if (File.Exists(@rutasEnModAdmin.RutaDeTemp + "/" + bcds.nombrecodigo + ".jpg"))
                                        r.InlineShapes.AddPicture(@rutasEnModAdmin.RutaDeTemp + "/" + bcds.nombrecodigo + ".jpg", Type.Missing, Type.Missing, Type.Missing);
                                    insertado = true;
                                }
                                Word.Shape pic;
                                foreach (Word.InlineShape s in doc.InlineShapes)
                                {
                                    if (s.Type == Word.WdInlineShapeType.wdInlineShapePicture)
                                    {
                                        pic = s.ConvertToShape();
                                        pic.Name = tempname;
                                        pic.Top = top;
                                        pic.Left = left;
                                        pic.Height = h;
                                        pic.Width = w;
                                    }
                                }
                            }

                        }
                        if (insertado)
                            break;
                    }

                }
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message);
                return;
            }
            foreach (CamposCodigos camp in ListaCodigos)
            {
                if (File.Exists(@rutasEnModAdmin.RutaDeTemp + "/" + camp.nombrecodigo + ".jpg"))
                    File.Delete(@rutasEnModAdmin.RutaDeTemp + "/" + camp.nombrecodigo + ".jpg");
            }
        }
开发者ID:GeMaths,项目名称:etiquetasPMM,代码行数:76,代码来源:EtiquetasPallet.cs

示例13: printRingForUser

        private void printRingForUser(UserShows userShow, int UserID, Document doc, ref List<int> defaultUsers, ref int pageCount)
        {
            String html = "";
            float[] ringColumns = new float[] { 300, 300, 300, 300};

            Font pageFont = FontFactory.GetFont("Arial", 22, Font.NORMAL);
            Font headerFont = new Font(Font.HELVETICA, 16, Font.BOLD, Color.BLACK);
            Font judgeFont = FontFactory.GetFont("Arial", 9, Font.BOLD);
            Font notInClassFont = new Font(Font.HELVETICA, 6, Font.NORMAL, Color.BLACK);
            Font inClassFont = new Font(Font.HELVETICA, 9, Font.NORMAL, Color.BLACK);
            Font font = new Font(Font.HELVETICA, 10, Font.NORMAL, Color.BLACK);
            Font font1 = FontFactory.GetFont("Arial", 18, Font.BOLD);
            Font dogNotInClass = new Font(Font.HELVETICA, 6, Font.NORMAL, Color.BLACK);
            Font dogInClass = new Font(Font.HELVETICA, 9, Font.NORMAL, Color.BLACK);
            Font dogDetailsInClass = new Font(Font.HELVETICA, 9, Font.BOLD, Color.BLACK);
            Fpp.WebModules.Business.User currentUser = new User(userShow.Userid);
            Shows show = new Shows(userShow.ShowID);

            List<ShowDetails> showDetailsList = ShowDetails.GetShowDaysList(userShow.ShowID);
            doc.Add(new Paragraph(show.ShowName, pageFont));

            Rings r = new Rings();
            DataSet ringList = r.GetAllRingsForShow(userShow.ShowID, "ShowDate");

            Dogs d = new Dogs();

            DogClasses dc = new DogClasses();
            DateTime dt = DateTime.Now;
            int currentRingID = 0;
            int ShowDetailsID = -1;
            int PrevShowDetailsID = -1;
            PdfPTable rings = new PdfPTable(ringColumns);

            int ringCnt = 0;
            PdfPCell cell = null;
            PdfPTable ringDetails = null;
            PdfPTable classDetailsTable = null;
            List<int> dogsRunningToday = new List<int>();
            foreach (DataRow ringRow in ringList.Tables[0].Rows)
            {
                int RingID = Convert.ToInt32(ringRow["RingID"]);
                ShowDetailsID = Convert.ToInt32(ringRow["ShowDetailsID"]);

                if (ringRow.IsNull("ClassID"))
                {
                    continue;
                }
                int ClassID = Convert.ToInt32(ringRow["ClassID"]);
                DateTime rowDT = Convert.ToDateTime(ringRow["ShowDate"]);
                if (rowDT != dt)
                {
                    if (currentRingID != 0)
                    {
                        if (ringCnt % 4 != 0)
                        {
                            var remind = ringCnt % 4;
                            while (remind-- > 0)
                            {
                                cell = new PdfPCell(new Phrase(new Chunk(" ", pageFont)));
                                cell.BorderWidth = 0;
                                rings.AddCell(cell);
                            }
                        }

                        doc.Add(rings);
                        if (currentUser.UserID == UserID)
                        {
                            doc.Add(getHandlerDetails(userShow, currentUser, PrevShowDetailsID, dogsRunningToday));
                        }
                        else
                        {
                            User defaultHandler = new User(UserID);
                            doc.Add(getHandlerDetails(userShow, defaultHandler, PrevShowDetailsID, dogsRunningToday));
                        }
                        doc.NewPage();
                        if (dogsRunningToday.Count > 0)
                        {
                            pageCount++;
                        }
                    }
                    dogsRunningToday.Clear();
                    doc.Add(new Paragraph(rowDT.ToString("dddd d MMM"), headerFont));
                    doc.Add(new Paragraph("  ", judgeFont));
                    dt = rowDT;
                    rings = new PdfPTable(ringColumns);
                    rings.WidthPercentage = 100;
                    ringCnt = 0;
                }

                if (currentRingID != RingID)
                {
                    ringCnt++;
                    ringDetails = new PdfPTable(1);
                    rings.AddCell(new PdfPCell( ringDetails));

                    List<Judge> judgeList = Judge.getJudgesForRingList(RingID);

                    cell = new PdfPCell(new Phrase(new Chunk("Ring No " + ringRow["RingNo"].ToString(), judgeFont)));
                    cell.BorderWidth = 0;
                    cell.HorizontalAlignment = PdfPCell.ALIGN_CENTER;
//.........这里部分代码省略.........
开发者ID:woofwoof88,项目名称:first-place-processing,代码行数:101,代码来源:pdfRunningPlan.ashx.cs

示例14: ExecuteCommand

        public void ExecuteCommand()
        {
           
            try
            {
                commandType = "[General Settings] ";
                LogHelper.Logger(commandType + "Saving logs at " + _logPath, _logPath);
                LogHelper.Logger(commandType + "Saving pdfs at " + _saveLocation, _logPath);
                var avianCommand = _helperAvian.Command;
                var seasonalCommand = _helperSeasonal.Command;
                var countryCommand = _helperCountry.Command;
                //add all temporary filenames in a list;
                var filenames = new List<string>();
                filenames.Add(_saveLocation + avianFilename + _filetype);
                filenames.Add(_saveLocation + seasonalFilename + _filetype);
                filenames.Add(_saveLocation + countryFilename + _filetype);
                commandType = "[PDF Generation] ";
                //LogHelper.Logger(commandType + avianCommand, _logPath);
                //LogHelper.Logger(commandType + seasonalCommand, _logPath);
                //LogHelper.Logger(commandType + countryCommand, _logPath);
                LogHelper.Logger(commandType + "Generating pdf.", _logPath);


                //avianCommand = "dir";
                try
                {
                    CommandHelper.ExecuteCommandSync(_tabserver, avianCommand);
                    CommandHelper.ExecuteCommandSync(_tabserver, seasonalCommand);
                    CommandHelper.ExecuteCommandSync(_tabserver, countryCommand);
                    
                }
                catch (Exception e)
                {
                    
                    LogHelper.Logger(commandType + e.Message, _logPath);
                }
                
                //Create Weekly PDF
                var yearnow = DateTime.Now.Year.ToString();
                var filename = yearnow + "-" + _weekNumber + _filetype;
                var targetPdf = _saveLocation + filename;
                
                
                try
                {

                    var tries = 0;
                    var NextRun = DateTime.Now;
                    var Now = DateTime.Now;
                    var exist = false;
                    while (!exist && tries < NO_OF_TRIES)
                    {
                        if (NextRun <= Now)
                        {
                            tries++;
                         
                            if (CheckIfExist(avianFilename) && CheckIfExist(seasonalFilename) && CheckIfExist(countryFilename))
                            {
                                LogHelper.Logger(commandType + "Merging pdf.", _logPath);
                                if (PdfMerger(filenames.ToArray(), targetPdf))
                                {
                                    LogHelper.Logger(commandType + " weekly PDF generation success.", _logPath);
                                    //Delete temporary files
                                    foreach (string file in filenames)
                                    {
                                        File.Delete(file);
                                    }
                                    //Create Yearly PDF
                                    filenames.Clear();
                                    LogHelper.Logger(commandType + " summary PDF generation.", _logPath);
                                    filenames.Add(targetPdf);
                                    var yearSummary = _saveLocation + yearnow + _filetype;
                                    if (PdfMerger(filenames.ToArray(), yearSummary))
                                    {
                                        LogHelper.Logger(commandType + " PDF generation success.", _logPath);
                                    }
                                    else
                                        LogHelper.Logger(commandType + " PDF generation failed.", _logPath);

                                }
                                else
                                    LogHelper.Logger(commandType + " PDF generation failed.", _logPath);

                                exist = true;
                                break;
                            }
                            else
                            {
                                NextRun = Now.AddMinutes(_waitingTime);
                                Console.WriteLine("Waiting for report to be generated");
                            }
                        }
                        Now = DateTime.Now;
                        Thread.Sleep(new TimeSpan(0,_waitingTime,0));
                     
                        var parameters = new Dictionary<string, object>();
                        parameters.Add("@flu_year", Now.Year);
                        parameters.Add("@flu_week", _weekNumber);
                        parameters.Add("@archive_id", 0);
                        parameters.Add("@new_id", 0);
//.........这里部分代码省略.........
开发者ID:bkferareza,项目名称:DarthMaul,代码行数:101,代码来源:TableauCommandExecutor.cs

示例15: StatsDashboard_Load

 private void StatsDashboard_Load(object sender, EventArgs e)
 {
     c_analiza.SelectedIndex = 1;
     c_tip_analize.SelectedIndex = 1;
     lista_teksta = new List<Tekst>();
     lista_stats = new List<Statistika>();
     lista_stats_text = new List<Statistika>();
     lista_PDF = new List<StatistikaTekst>();
     podsuma = 0;
     OdbcConnection connection = new OdbcConnection();
     connection.ConnectionString = "DSN=PostgreSQL35W;UID=masterwordcounter;PWD=masterwordcounter";
     connection.Open();
     string q = "SELECT id,name,content,author FROM texts";
     OdbcCommand getAllTexts = new OdbcCommand(q, connection);
     OdbcDataReader odr = getAllTexts.ExecuteReader();
     lista_teksta.Clear();
     while (odr.Read())
     {
         Tekst t = new Tekst();
         t.Id = odr.GetInt32(0);
         t.Sadrzaj = odr.GetString(2);
         t.Naziv = odr.GetString(1);
         t.Autor = odr.GetString(3);
         lista_teksta.Add(t);
     }
     c_tekst.DataSource = null;
     c_tekst.DataSource = lista_teksta;
     connection.Close();
     odr.Close();
 }
开发者ID:dbajramovic,项目名称:masterwordcounter,代码行数:30,代码来源:StatsDashboard.cs


注:本文中的iTextSharp.text.List.Clear方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。