Hi
String you set as custom bullet can be just a string or a hex code of symbol. If you write builder.getListFormat().getListLevel().setNumberFormat("\x00A8"); string isn’t hex code. That’s why you get garbed output. Try to use following code. builder.getListFormat().getListLevel().setNumberFormat("\x00A8");
or builder.getListFormat().getListLevel().setNumberFormat("-");
if you want use “-” as bullet.
I hope that it will help you.
Hi Vitaly,
In java if you want to assign a string “\x00A8” it will give an error , you need to provide a escape sequence for character “”. So the String would be \x00A8" .
Also my query was about reading the list charater like bullet , diamond bullet or start bullet.
currently i am using following code to determine if the list style is a bullet or not.
Hi
You can try to get an array of symbol codes. Than get a symbol of current bullet and search it in the array. See following example.
if (listStyle == NumberStyle.Bullet)
{
listStyleDefn = "BULLET";
// geting symbol code
int symbolCode = Convert.ToChar(listLevel.NumberFormat);
switch (symbolCode)
{
case 111:
{
symbol = "circle";
break;
}
case 61607:
{
symbol = "square";
break;
}
case 183:
{
symbol = "disk";
break;
}
case 168:
{
symbol = "romb";
break;
}
case 61482:
{
symbol = "star";
break;
}
default:
{
symbol = "unknown";
break;
}
}
}
So the getNumberFormat()if ListLevel returns string. The value of string returned is a special character like ‘?’ or ‘o’. This is throwing an exception whein i try to use following code,
Hello Vitaly,
Thanks a lot for the information. I was able to proceed , but i am still facing some problem,
I see following type of bullets.
BULLET_DEFAULT, BULLET_CIRCLE, BULLET_SQUARE, BULLET_DISK,BULLET_ROMB,BULLET_STAR
The following is only returning two values 63 and 111
String s = listLevel.getNumberFormat();
byte[] codes = s.getBytes(“US-ASCII”);
byte code = codes[0];
111 for BULLET_CIRCLE
63 for BULLET_DEFAULT, BULLET_SQUARE, BULLET_DISK, BULLET_ROMB and BULLET_STAR.
I am not sure but i feel when we are doing transformation from string to array of bytes are some value getting truncated. A unsigned byte can 128 so it might be truncating the value. I tried getting length of the “byte[] codes” it was “1” for all the type of bullets.
Thanks,
Anup
I am also facing similar problem. How can I determine the type of the bullet? s.getBytes(“UTF-8”) is not working and with s.getBytes(“US-ASCII”) only two values 63 and 111 are being retrieved.
Hello!
Thank you for your interest in Aspose.Words.
Please attach the source document or show how you are constructing it. Are you also using Aspose.Words for Java? I’ll take a look how we can determine bullet types.
Regards,