iTextSharp.text.GreekList.Add C# (CSharp) Метод

Add() публичный Метод

public Add ( IElement o ) : bool
o IElement
Результат bool
        public override bool Add(IElement o)
        {
            if (o is ListItem) {
                ListItem item = (ListItem) o;
                Chunk chunk = new Chunk(preSymbol, symbol.Font);
                chunk.Attributes = symbol.Attributes;
                chunk.Append(GreekAlphabetFactory.GetString(first + list.Count, lowercase));
                chunk.Append(postSymbol);
                item.ListSymbol = chunk;
                item.SetIndentationLeft(symbolIndent, autoindent);
                item.IndentationRight = 0;
                list.Add(item);
                return true;
            } else if (o is List) {
                List nested = (List) o;
                nested.IndentationLeft = nested.IndentationLeft + symbolIndent;
                first--;
                list.Add(nested);
                return true;
            }
            return false;
        }

Usage Example

Пример #1
0
// ===========================================================================
    public void Write(Stream stream) {
      // step 1
      using (Document document = new Document()) {
        // step 2
        PdfWriter.GetInstance(document, stream);
        // step 3
        document.Open();
        // step 4
        var SQL = 
@"SELECT DISTINCT mc.country_id, c.country, count(*) AS c
FROM film_country c, film_movie_country mc
WHERE c.id = mc.country_id
GROUP BY mc.country_id, country ORDER BY c DESC";  
        // Create a list for the countries
        List list = new RomanList();
        // loop over the countries
        using (var c =  AdoDB.Provider.CreateConnection()) {
          c.ConnectionString = AdoDB.CS;
          using (DbCommand cmd = c.CreateCommand()) {
            cmd.CommandText = SQL;        
            c.Open();            
            using (var r = cmd.ExecuteReader()) {
              while (r.Read()) {
              // create a list item for the country
                ListItem item = new ListItem(
                  string.Format("{0}: {1} movies",
                    r["country"].ToString(), r["c"].ToString()
                  )
                );
                // Create a list for the movies
                List movielist = new GreekList();
                movielist.Lowercase = List.LOWERCASE;
                // Loop over the movies
                foreach (Movie movie in 
                    PojoFactory.GetMovies(r["country_id"].ToString())
                ) {
                  ListItem movieitem = new ListItem(movie.MovieTitle);
                  // Create a list for the directors
                  List directorlist = new ZapfDingbatsNumberList(0); 
                  // Loop over the directors                 
                  foreach (Director director in movie.Directors) {
                    directorlist.Add(String.Format("{0}, {1}",
                      director.Name, director.GivenName
                    ));
                  }
                  movieitem.Add(directorlist);
                  movielist.Add(movieitem);
                }
                item.Add(movielist);
                list.Add(item);
              }
              document.Add(list);
            }
          }
        }
      }
    }
All Usage Examples Of iTextSharp.text.GreekList::Add