Package jxl.write

Examples of jxl.write.DateFormat


  }

  protected DateFormat getDateFormat(String pattern)
  {
    String convertedPattern = getConvertedPattern(pattern);
    DateFormat cellFormat = (DateFormat) dateFormats.get(convertedPattern);
    if (cellFormat == null)
    {
      cellFormat = new DateFormat(convertedPattern);
      dateFormats.put(convertedPattern, cellFormat);
    }
    return cellFormat;
  }
View Full Code Here


    cf1 = new WritableCellFormat(DateFormats.FORMAT12);
    dt = new DateTime(0,13,date, cf1, DateTime.GMT);
    s.addCell(dt);

    // Custom formats
    DateFormat df = new DateFormat("dd MM yyyy");
    cf1 = new WritableCellFormat(df);
    l = new Label(2, 2, "dd MM yyyy");
    s.addCell(l);

    dt = new DateTime(3, 2, date, cf1, DateTime.GMT);
    s.addCell(dt);

    df = new DateFormat("dd MMM yyyy");
    cf1 = new WritableCellFormat(df);
    l = new Label(2, 3, "dd MMM yyyy");
    s.addCell(l);

    dt = new DateTime(3, 3, date, cf1, DateTime.GMT);
    s.addCell(dt);
    df = new DateFormat("hh:mm");
    cf1 = new WritableCellFormat(df);
    l = new Label(2, 4, "hh:mm");
    s.addCell(l);

    dt = new DateTime(3, 4, date, cf1, DateTime.GMT);
    s.addCell(dt);

    df = new DateFormat("hh:mm:ss");
    cf1 = new WritableCellFormat(df);
    l = new Label(2, 5, "hh:mm:ss");
    s.addCell(l);

    dt = new DateTime(3, 5, date, cf1, DateTime.GMT);
    s.addCell(dt);

    df = new DateFormat("H:mm:ss a");
    cf1 = new WritableCellFormat(df);
    l = new Label(2, 5, "H:mm:ss a");
    s.addCell(l);

    dt = new DateTime(3, 5, date, cf1, DateTime.GMT);
    s.addCell(dt);
    dt = new DateTime(4, 5, date13, cf1, DateTime.GMT);
    s.addCell(dt);

    df = new DateFormat("mm:ss.SSS");
    cf1 = new WritableCellFormat(df);
    l = new Label(2, 6, "mm:ss.SSS");
    s.addCell(l);

    dt = new DateTime(3, 6, date, cf1, DateTime.GMT);
    s.addCell(dt);

    df = new DateFormat("hh:mm:ss a");
    cf1 = new WritableCellFormat(df);
    l = new Label(2, 7, "hh:mm:ss a");
    s.addCell(l);

    dt = new DateTime(4, 7, date13, cf1, DateTime.GMT);
View Full Code Here

      n.setValue(n.getValue() + 0.1);
    }

    // Change the date format of cell B17 to be a custom format
    cell = sheet.getWritableCell(1,16);
    DateFormat df = new DateFormat("dd MMM yyyy HH:mm:ss");
    cf = new WritableCellFormat(df);
    cell.setCellFormat(cf);

    // Change the date format of cell B18 to be a standard format
    cell = sheet.getWritableCell(1,17);
View Full Code Here

            }
            else
            {
               try
               {
                  cellFormat = new WritableCellFormat(new DateFormat(cellStyle.formatMask));
               }
               catch (IllegalArgumentException e)
               {
                  throw new ExcelWorkbookException(Interpolator.instance().interpolate("Could not create date format for mask {0}", cellStyle.formatMask), e);
               }
View Full Code Here

        {
            return displayFormat;
        }
        try
        {
            displayFormat = new DateFormat(formatMask);
        }
        catch (IllegalArgumentException e)
        {
            // no-op, it was worth a try;
        }
View Full Code Here

            }
            else
            {
               try
               {
                  cellFormat = new WritableCellFormat(new DateFormat(cellStyle.formatMask));
               }
               catch (IllegalArgumentException e)
               {
                  throw new ExcelWorkbookException(Interpolator.instance().interpolate("Could not create date format for mask {0}", cellStyle.formatMask), e);
               }
View Full Code Here

TOP

Related Classes of jxl.write.DateFormat

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.