We're sorry Aspose doesn't work properply without JavaScript enabled.

Free Support Forum - aspose.com

Error when clone slide with Turkish locale

Hi,

Some of our users have Turkish locale on their PCs. In this case they get an error when clone slides.
If the same user changes PC locale to English, then the same presentation can be cloned well.
See presentations and error message attached.

Hi Citbor,

I have observed the inquiry shared by you and like to share that Aspose.Slides actually does not support non standard locales. In fact, Aspose.Slides throw java.lang.IllegalArgumentException for wrong Locale or non standard locale selection. I have tried using the turkish locale on my end using Aspose.Slides for Java 8.0.0 in Windows 7 x64 with JDK 1.6. I have tried accessing your PPT and converting to PDF and it worked.

public static void CheckLocale() throws FileNotFoundException
{
try{

// Locale.setDefault(new Locale(“en”));
Locale.setDefault(new Locale(“tr-TR”));
String base = “D:/Aspose Data/”;

FileInputStream inputStream = new FileInputStream(base + “Regions_and_Countries_Algeria.ppt”);
Presentation presentation = new Presentation(inputStream);
presentation.save(base + “Regions_and_Countries_Algeria.pdf”, SaveFormat.Pdf);
}
catch(IllegalArgumentException e)
{
e.printStackTrace();
}

}

Can you please try using the specified version of Aspose.Slides on your end and share the sample java file, operating system and JDK details with us for further investigation on our end. I will try my best to help you further in this regard.

Many Thanks,


Mudassir,

We do not need PDF. We cannot combine 2 presentations (provided in my previous post) into 1 presentation.

We do not have any non-standard locales, it is not clear what you mean by this.
Our turkish users have standard PC with Windows. Turkish locale is configured in Windows Control Panel -> Regional Settings.
In this case it has a similar effect to this Java code: Locale.setDefault(new Locale(“tr-TR”));

This is our Java code, we provide a list of files to be combined as method’s parameter:
protected static Presentation assemblePresentation(List sourceFiles)
throws FileNotFoundException {
final Presentation presentation = new Presentation();

for (int ii = sourceFiles.size() - 1; ii >= 0; --ii) {
final String sourceFile = sourceFiles.get(ii);
Presentation src = new Presentation(sourceFile);

final SortedList ids = new SortedList();
for (int pos = src.getFirstSlideNumber(); pos <= src.getSlides().getLastSlidePosition(); pos++) {
src.cloneSlide(src.getSlideByPosition(pos), pos, presentation, ids);
}
}
if (presentation.getSlides().getLastSlidePosition() > 1) {
final Slide empty = presentation.getSlideByPosition(presentation.getSlides().getLastSlidePosition());
presentation.getSlides().remove(empty);
}
return presentation;
}

Hi Citbor,

I have used Aspose.Slides for Java 8.1.0 using following sample code shared by you and have not been able to observe any issue while merging the two slides. I did not say that Turkish is non-standard and I shared with you in my previous sample code example as well that setting Turkish locale worked for me while exporting to PDF. Now, I have used your code for merging presentations by setting Turkish locale and it too worked without any issue. I am using Windows 7 x64 with JDK 1.6 installed. Can you please try using the specified version of Aspose.Slides for Java on your end. If there is still an issue then please share the complete environment and operating system details where by you are using Aspose.Slides.

public static Presentation assemblePresentation(List sourceFiles)
throws FileNotFoundException {
Locale.setDefault(new Locale(“tr-TR”));
final Presentation presentation = new Presentation();

for (int ii = sourceFiles.size() - 1; ii >= 0; --ii) {
final String sourceFile = sourceFiles.get(ii);
Presentation src = new Presentation(sourceFile);

final SortedList ids = new SortedList();
for (int pos = src.getFirstSlideNumber(); pos <= src.getSlides().getLastSlidePosition(); pos++) {
src.cloneSlide(src.getSlideByPosition(pos), pos, presentation, ids);
}
}
if (presentation.getSlides().getLastSlidePosition() > 1) {
final Slide empty = presentation.getSlideByPosition(presentation.getSlides().getLastSlidePosition());
presentation.getSlides().remove(empty);
}
return presentation;
}


Many Thanks,

Mudassir,

Unfortunately you use a wrong approach to setup turkish locale, the Java code to setup Locale should be:
Locale.setDefault(new Locale(“tr”, “TR”));

And basically our turkish users do not use Java code to setup locale, it is obtained by Java VM automatically from Window settings.

Please reproduce the issue and advise a solution.

Hi Citbor.

I have tried setting the Locale by using Locale constructor as you have shared and have been able to observe the issue. I like to share that an issue with ID SLIDESJAVA-34152 has already been created in our issue tracking system to investigate and resolve the issue of setting the new Locale using following code as on your end.

Locale.setDefault(new Locale(“tr”, “TR”));


For the time being, I suggest you setting the Locale using following code as it worked on my end.


Locale.setDefault(new Locale(“tr-TR”));


Many Thanks,

The issues you have found earlier (filed as SLIDESJAVA-34152) have been fixed in this update.


This message was posted using Notification2Forum from Downloads module by Aspose Notifier.
(2)