OpenDocument4all - Info and tools about OpenDocument
Saturday, 19 May 2012
Home
Main Menu
Home
My Blog
AODL - Project
AODC - Project
OO Development & Info
Forum
About OpenDocument ...
Search
News
Contact Us
Login Form





Lost Password?
No account yet? Register
Newsfeed
Sourceforge.net

SourceForge.net - Goto the project homepage
Project site on SF.net

 

Demand OpenDocument

 

Countomat Webcounter und Webstatistik (Statistik & Logfileanalyse, Counter)

Recent Posts
  • 2007-03-13 10:34:44 AODL is now part of the ODF Toolkit project of OpenOffice.org
    I'm proud to announce that AODL is now part of the ODF Toolkit project of OpenOffice.org. The sourcecode has already moved to the CVS server of OpenOffice.org. You will find more information and a detailed description of how to do a CVS checkout at OpenOffice.org on the AODL Wiki page at OpenOf ... .
     
  • 2007-02-14 10:37:55 First part of the Master Page Styles implementation
    The first part of the Master Page Styles implementation is done and already checked in into the CVS repository. Now, you can set up the page properties like page orientation and the margins for the different page sides. The following code snippte will show you how to do this. TextDocument documen ... .
     
  • 2007-02-08 17:42:25 A short stop ... but not really ...
    Since I've promised you to implement also the page setup handling for the OpenDocument to PDF exporter for AODL I have to make a short stop with the PDF export implementation. I've decided to do this, because the OpenDocument master page handling in AODL is up to now very rudimentary, but for genera ... .
     
  • 2007-02-07 11:06:50 PDF export for AODL/ODF - the current state of implementation
    During the last two days I was able to implement the image support. The images should be positioned well, whether with or no surrounding text parts and keeping possible resize info of embed pictures alive. Therefor I have extended the AODL ODF graphic implementation in this way that the object will ... .
     
  • 2007-02-04 23:28:18 Up to the PDF table implementation ...
    After a lot of coding for the PDF exporter add on for AODL this weekend I have reached the first running state for simple PDF table support. On the way to the simple table support I have also successfully implemented paragraphs, simple text, formated text, whitespaces, headings, fonts, font properti ... .
     
RGB color converter for OpenOffice colors Print E-mail
Written by Lars Behrmann   
Thursday, 29 December 2005
If you develop applications for OpenOffice and get a color property value e.g. CellBackground then you will recieve the color as an RGB color. Now, you want to have this color converted to a Hex color, but OpenOffice doesn't offer you a mehod to do that. In this case you can use my RGBConverter class. It is available as a .net / C# and Java solution.

I think the usage is really simple so that it need no further statements. Just copy the source and use it.

Java version:

import java.lang.*;

public class RGBConverter
{
       /*
        * Use me like this RGBConverter.ToHexColor(myRgbColor)
        */
   public static String ToHexColor(String rgbColor)
   {   
      int length               = rgbColor.length();
      if(length < 9)
      {
         int fillCnt            = 9-length;
         StringBuilder fillStr   = new StringBuilder(rgbColor);
         for(int i=0; i<fillCnt; i++)
            fillStr            = fillStr.insert(0, "0");
         rgbColor            = fillStr.toString();
      }
      String rColor            = rgbColor.substring(0, 3);
      String gColor            = rgbColor.substring(3, 6);
      String bColor            = rgbColor.substring(6);
      Integer irColor            = new Integer(rColor);
      Integer igColor            = new Integer(gColor);
      Integer ibColor            = new Integer(bColor);
      rColor                  = Integer.toHexString(irColor.intValue());
      gColor                  = Integer.toHexString(igColor.intValue());
      bColor                  = Integer.toHexString(ibColor.intValue());
      rgbColor               = "#"
         +((rColor.equals("0"))?"00":rColor)
         +((gColor.equals("0"))?"00":gColor)
         +((bColor.equals("0"))?"00":bColor);
   
      return rgbColor;
  }
}

C# version:

public class RGBConverter
{
   //Use me like this RGBConverter.ToHexColor(anRGBColor)
   public static string ToHexColor(string rgbColor)
   {
      //need leading zeros ?
      if(rgbColor.Length < 9)
         //fill up with leading zeros
         rgbColor      = rgbColor.PadLeft(9, '0');
      //our rgb values
      int rValue      = Convert.ToInt32(rgbColor.Substring(0,3));
      int gValue      = Convert.ToInt32(rgbColor.Substring(3,3));
      int bValue      = Convert.ToInt32(rgbColor.Substring(6));
      //convert into hex
      string srValue   = ((rValue!=0)?rValue.ToString("x"):"00");
      string sgValue   = ((gValue!=0)?gValue.ToString("x"):"00");
      string sbValue   = ((bValue!=0)?bValue.ToString("x"):"00");
      //build hex color
      string hexColor   = "#"
                  //fill with leading zeros, if needed
                  + srValue.PadLeft(2, '0')
                  + sgValue.PadLeft(2, '0')
                  + sbValue.PadLeft(2, '0');
      
      return hexColor;
   }
}.

 
< Prev   Next >
Quick jump
Download area
Who's Online
We have 24 guests online
Polls
Should AODL and AODC also implement export as PDF and RTF?
 
Popular
© 2005 MamboZ. All rights reserved.