cancel
Showing results for 
Search instead for 
Did you mean: 

Hi friends, Problems with Special Characters in Table download to Excel.

Former Member
0 Kudos

Hi friends,

I am using Binary Cache method to download to excel. The problem is that there are certain fields in the back end R/3 that has special characters in it eg : & * £ # etc.

As a result, the download is not working for these rows. Please can any of you tell me how to get rid of this. As an example let's say I wan to replace the "&" with "and".

Please help.

Thank You.

Avik

Accepted Solutions (1)

Accepted Solutions (1)

former_member751941
Active Contributor
0 Kudos

Hi Avik,

Just try it.

String Str = "Hello & World & How r You?";(Take the Context attribute Value)

String newStr = Str.replaceAll("&","And");

http://java.sun.com/j2se/1.4.2/docs/api/java/lang/String.html

Regards,

Mithu

Answers (3)

Answers (3)

Former Member
0 Kudos

Thanks guys..... It Rocks....!!!!!

I used the replaceAll() method. Saves a lot of time and effort in Coding.

Former Member
0 Kudos

hi,

this the updated one,

public void CheckMethod( )

{

//@@begin CheckMethod()

test = wdContext.currentTestStringConversionElement().getInput();

n=test.length();

if(n!=0)

{

for(i=1;i<=n;i++)

{

c = test.charAt(i-1);

if (c=='&')

{

break;

}

}

subtest = Character.toString(c) ;

sub2= " and ";

// replaces string "&" with string "and"

test1 = test.replaceAll(subtest,sub2);

wdContext.currentTestStringConversionElement().setOutput(test1);

}

Former Member
0 Kudos

hi,

Hope you find tgis of some help !!

public void ReplaceMethod( )

{

//@@begin ReplaceMethod()

// get the string value of the cell (for you from the table cell, for eg, Pinki & Rakesh)

test = wdContext.currentTestStringConversionElement().getInput();

// calculate the total length of the String

n=test.length ();

if(n!=0)

{

for(i=1;i<=n;i++)

{

// catching each character from the String

c = test.charAt (i-1);

// checking if any character within the String (eg, Pinki & Rakesh) is “&”

if (c=='&')

{

wdContext.currentTestStringConversionElement().setOutput(Character.toString(c));

no=i;

break;

}

}

String val = Integer.toString(no);

//wdContext.currentTestStringConversionElement().setNo(val);

// breaking the String and adding “ and” in place of “&”

sub1= test.substring(0,i-1);

sub2= " and ";

sub3= test.substring(i,n);

//Concatenating the String

test1 = sub1sub2sub3;

//Printing the String

wdContext.currentTestStringConversionElement().setOutput(test1);

}