Free Support Forum - aspose.com

Unsupported Language

Hi
I am using the latest Version of Aspose.Cells and using .Net .

Here is how my program works:

  1. I upload a excel and initiate a Workbook
  2. I use aspose to change some value in the excel.
    3.After that, I will export excel file as pdf by using Aspose.Cells.Save().

While some excel will give an exception which is Culture ID xxxxx (0xXXXX) is not a supported culture.
The reason is the excel file set some format on some cells and the window does not support the culture.

I want to block the excel when uploading the excel if that contains some unsupported culture. So, i export once when i upload any excel so i can know if the excel contains any unsupported format. However, if the cells with unsupported format but it does not have any value. It still can export.

Here is my question:

  1. Is there anyway to check if there is any cell has set format(Like: date, currency, etc)?
  2. Is there any suggestion/method to handle this case on step 1 of my program (Check any unsupported culture format when uploading.)?
    3.(This question may not relevant to this topic but this bothers me) Is there any way to get a cell range which is actively using (From the top left cell to the bottom right cell)?

@NickMina,
Regarding your first question, you may please use Cell.GetStyle() function to check the format of a cell. It returns all the formatting information of a cell.

Workbook workbook = new Workbook();
var style = workbook.Worksheets[0].Cells["A1"].GetStyle();

Regarding the second question, there is no such option which can stop loading an Excel file containing unsupported Culture but you may try LoadDataFilterOptions while loading a file. It allows to load filtered data only say load workbook settings only and nothing else. In this way you may check the workbook settings and culture info first and then depending upon the support for that Culture on your system load the Workbook data and other information respectively. Have a look at the following sample code:

Aspose.Cells.LoadOptions loadOptions = new Aspose.Cells.LoadOptions(Aspose.Cells.LoadFormat.Auto)
{
    LoadFilter = new LoadFilter(LoadDataFilterOptions.BookSettings)
};
Workbook wb2 = new Workbook(@"book1.xlsx", loadOptions);
Console.WriteLine(wb2.Settings.CultureInfo.Name);

Another option is to load the Excel file according to your Culture to avoid such errors as demonstrated in the following article:

Load the workbook with specific system culture info

Please give try to these options and share the feedback. If it does not fulfil your requirements, please print out the default culture info and the CID and send that information to us so we can make further investigation. You may also share your sample Excel file, runnable console application and complete system information to reproduce this scenario here. We will observe the issue here and provide assistance accordingly.

hi @ahsaniqbalsidiqui,
Thanks for your help and quick reply. I think your sample code does not suit me because your code could only check the whole excel CultureInfo. However, if i set only one cell date time format for example Yiddish/Xitsonga/Gregorian(I tried these three and error comes out) and one or more than one of them are unsupported in my server(Window Server 2008 R2 SP1). The CultureInfo is still the same.
Finally, i used my way to search the problem cell. So, the problem is currently kinda handled.
Once again, thank you for your help. It does inspired me!

best regards,
NickMina

@NickMina,
Thanks for the feedback.

Feel free to contact us any time if you need further help or have some other issue or queries, we will be happy to assist you soon.