We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy. Image for the cookie policy date

A Problem with XLSIO

Hi,

I am attempting to use XLSIO to create a new Excel document with some CELL style, like mergion, SetFont and set RowHeight, rang verticalAlignment, formula and so on, but when i use IWorkBook.SaveAs to save the new Excel document,there is a exception.
the exception message is:
Style with specified name does not exist. Name normal parament name: value.
can you help me with this problem? thanks!

anthoer question is can i set FontName a chinese name, such as "宋体"?

7 Replies

LR Lokesh R Syncfusion Team March 29, 2010 09:35 AM UTC

Hi White,

Thank you very much for your interest on Syncfusion products.

Exception occurs while saving the document :

The information which you have posted is not sufficient for reproducing the issue at our side, could you please update us with the following details

1.Syncfusion assembly version no, with which the issue is produced.
2.Excel format, which you have tried to save.(e.g.,2003,2007,2010).
3.Issue reproducing code snippet.

Using Chinese Font Names :

yes, it is possible to use the Chinese font name as in your post and also i have created a sample for the same with our latest assembly 8.1.0.30,Could you please get the sample and the assemblies from the below link and let us know if this helps you.


http://help.syncfusion.com/samples/XlsIO.Windows/93671.zip

please, let us know if you need more clarifications.

Regards,
Lokesh


WH whitebird April 1, 2010 03:15 PM UTC

Hi Lokesh

Thank you very much for your answer!

the details of my question is:

1.Syncfusion assembly version no which I have used is 7.2.0.20
2.the Excel format is Microsoft Excel 2003.
3 the code which create a new Excel document as follow:
/******************************************************************/
ExcelEngine firstExcelEngine = new ExcelEngine();
IApplication firstApplication = firstExcelEngine.Excel;

IWorkbook firstWorkbook = firstApplication.Workbooks.Create(3);
IWorksheet firstSheet = firstWorkbook.Worksheets[0];
firstSheet.IsGridLinesVisible = true;
#region 设置模板格式
//设置模板格式
firstSheet.Range["A5:R71"].RowHeight = 20;
firstSheet.Range["A1"].ColumnWidth = 12;
firstSheet.Range["B1"].ColumnWidth = 30;

firstSheet.Range["A1:R71"].CellStyle.Borders.LineStyle = ExcelLineStyle.Thin;
firstSheet.Range["A1:R71"].CellStyle.Borders[ExcelBordersIndex.DiagonalDown].ShowDiagonalLine = false;
firstSheet.Range["A1:R71"].CellStyle.Borders[ExcelBordersIndex.DiagonalUp].ShowDiagonalLine = false;


IRange range = firstSheet.Range["A1:R1"];
range.Text = "埃罚罚阿发的噶啊风格按时到岗敖德萨完全士大夫阿道夫";
IRichTextString rtf = range.RichText;

IFont headFont = firstWorkbook.CreateFont();
headFont.Size = 22;
headFont.Bold = true;
headFont.FontName = "华文行楷";
headFont.RGBColor = Color.FromArgb(0, 0, 0);
rtf.SetFont(0, 19, headFont);
firstSheet.Range["A1:R1"].HorizontalAlignment = ExcelHAlign.HAlignCenter;
firstSheet.Range["A1:R1"].VerticalAlignment = ExcelVAlign.VAlignCenter;
firstSheet.Range["A1:R1"].Merge();
firstSheet.Range["A1:R1"].RowHeight = 45;

firstSheet.Range["A2:B3"].Text = "阿道夫的";
firstSheet.Range["A2:B3"].HorizontalAlignment = ExcelHAlign.HAlignCenter;
firstSheet.Range["A2:B3"].VerticalAlignment = ExcelVAlign.VAlignCenter;
firstSheet.Range["A2"].RowHeight = 55;
firstSheet.Range["B3"].RowHeight = 45;
firstSheet.Range["A2:B3"].Merge();

firstSheet.Range["C2:D2"].Text = "噶尔啊爱的";
firstSheet.Range["C2:D2"].WrapText = true;
firstSheet.Range["C2:D2"].HorizontalAlignment = ExcelHAlign.HAlignCenter;
firstSheet.Range["C2:D2"].VerticalAlignment = ExcelVAlign.VAlignCenter;
firstSheet.Range["C2:D2"].Merge();

firstSheet.Range["E2:F2"].Text = "啊和人噶式的风格阿瑟";
firstSheet.Range["E2:F2"].WrapText = true;
firstSheet.Range["E2:F2"].HorizontalAlignment = ExcelHAlign.HAlignCenter;
firstSheet.Range["E2:F2"].VerticalAlignment = ExcelVAlign.VAlignCenter;
firstSheet.Range["E2:F2"].Merge();

firstSheet.Range["G2:H2"].Text = "他噶威尔啊";
firstSheet.Range["G2:H2"].WrapText = true;
firstSheet.Range["G2:H2"].HorizontalAlignment = ExcelHAlign.HAlignCenter;
firstSheet.Range["G2:H2"].VerticalAlignment = ExcelVAlign.VAlignCenter;
firstSheet.Range["G2:H2"].Merge();

firstSheet.Range["I2:J2"].Text = "还是人噶尔噶尔";
firstSheet.Range["I2:J2"].WrapText = true;
firstSheet.Range["I2:J2"].HorizontalAlignment = ExcelHAlign.HAlignCenter;
firstSheet.Range["I2:J2"].VerticalAlignment = ExcelVAlign.VAlignCenter;
firstSheet.Range["I2:J2"].Merge();

firstSheet.Range["K2:L2"].Text = ",风格加入阿斯特我";
firstSheet.Range["K2:L2"].WrapText = true;
firstSheet.Range["K2:L2"].HorizontalAlignment = ExcelHAlign.HAlignCenter;
firstSheet.Range["K2:L2"].VerticalAlignment = ExcelVAlign.VAlignCenter;
firstSheet.Range["K2:L2"].Merge();

firstSheet.Range["M2:N2"].Text = "式的复合热她莞尔";
firstSheet.Range["M2:N2"].WrapText = true;
firstSheet.Range["M2:N2"].HorizontalAlignment = ExcelHAlign.HAlignCenter;
firstSheet.Range["M2:N2"].VerticalAlignment = ExcelVAlign.VAlignCenter;
firstSheet.Range["M2:N2"].Merge();

firstSheet.Range["O2:P2"].Text = "个哈维尔啊热舞";
firstSheet.Range["O2:P2"].WrapText = true;
firstSheet.Range["O2:P2"].HorizontalAlignment = ExcelHAlign.HAlignCenter;
firstSheet.Range["O2:P2"].VerticalAlignment = ExcelVAlign.VAlignCenter;
firstSheet.Range["O2:P2"].Merge();

firstSheet.Range["Q2:R2"].Text = "阿尔特巍峨";
firstSheet.Range["Q2:R2"].WrapText = true;
firstSheet.Range["Q2:R2"].HorizontalAlignment = ExcelHAlign.HAlignCenter;
firstSheet.Range["Q2:R2"].VerticalAlignment = ExcelVAlign.VAlignCenter;
firstSheet.Range["Q2:R2"].Merge();

firstSheet.Range["A4:B4"].Text = "按人头瓦";
firstSheet.Range["A4:B4"].HorizontalAlignment = ExcelHAlign.HAlignCenter;
firstSheet.Range["A4:B4"].VerticalAlignment = ExcelVAlign.VAlignCenter;
firstSheet.Range["A4:B4"].Merge();

firstSheet.Range["C3"].Text = "阿尔文人她莞尔";
//firstSheet.Range["C3"].ColumnWidth = 20;
firstSheet.Range["C3"].HorizontalAlignment = ExcelHAlign.HAlignCenter;
firstSheet.Range["C3"].VerticalAlignment = ExcelVAlign.VAlignCenter;
firstSheet.Range["D3"].Text = "爱他艾薇儿";
firstSheet.Range["D3"].WrapText = true;
//firstSheet.Range["D3"].ColumnWidth = 10;
firstSheet.Range["D3"].HorizontalAlignment = ExcelHAlign.HAlignCenter;
firstSheet.Range["D3"].VerticalAlignment = ExcelVAlign.VAlignCenter;
firstSheet.Range["E3"].Text = "奥维尔特艾薇儿";
firstSheet.Range["E3"].HorizontalAlignment = ExcelHAlign.HAlignCenter;
firstSheet.Range["E3"].VerticalAlignment = ExcelVAlign.VAlignCenter;
firstSheet.Range["F3"].Text = "奥维尔特我";
firstSheet.Range["F3"].WrapText = true;
firstSheet.Range["F3"].HorizontalAlignment = ExcelHAlign.HAlignCenter;
firstSheet.Range["F3"].VerticalAlignment = ExcelVAlign.VAlignCenter;
firstSheet.Range["G3"].Text = "奥维尔特";
firstSheet.Range["G3"].HorizontalAlignment = ExcelHAlign.HAlignCenter;
firstSheet.Range["G3"].VerticalAlignment = ExcelVAlign.VAlignCenter;
firstSheet.Range["H3"].Text = "年招生量";
firstSheet.Range["H3"].WrapText = true;
firstSheet.Range["H3"].HorizontalAlignment = ExcelHAlign.HAlignCenter;
firstSheet.Range["H3"].VerticalAlignment = ExcelVAlign.VAlignCenter;
firstSheet.Range["I3"].Text = "奥维尔特";
firstSheet.Range["I3"].HorizontalAlignment = ExcelHAlign.HAlignCenter;
firstSheet.Range["I3"].VerticalAlignment = ExcelVAlign.VAlignCenter;
firstSheet.Range["J3"].Text = "年招生量";
firstSheet.Range["J3"].WrapText = true;
firstSheet.Range["J3"].HorizontalAlignment = ExcelHAlign.HAlignCenter;
firstSheet.Range["J3"].VerticalAlignment = ExcelVAlign.VAlignCenter;
firstSheet.Range["K3"].Text = "奥维尔特我";
firstSheet.Range["K3"].HorizontalAlignment = ExcelHAlign.HAlignCenter;
firstSheet.Range["K3"].VerticalAlignment = ExcelVAlign.VAlignCenter;
firstSheet.Range["L3"].Text = "5以 地方饿";
firstSheet.Range["L3"].WrapText = true;
firstSheet.Range["L3"].HorizontalAlignment = ExcelHAlign.HAlignCenter;
firstSheet.Range["L3"].VerticalAlignment = ExcelVAlign.VAlignCenter;
firstSheet.Range["M3"].Text = "是否会 ";
firstSheet.Range["M3"].HorizontalAlignment = ExcelHAlign.HAlignCenter;
firstSheet.Range["M3"].VerticalAlignment = ExcelVAlign.VAlignCenter;
firstSheet.Range["N3"].Text = "年招生量";
firstSheet.Range["N3"].WrapText = true;
firstSheet.Range["N3"].HorizontalAlignment = ExcelHAlign.HAlignCenter;
firstSheet.Range["N3"].VerticalAlignment = ExcelVAlign.VAlignCenter;
firstSheet.Range["O3"].Text = "其3 那位";
firstSheet.Range["O3"].HorizontalAlignment = ExcelHAlign.HAlignCenter;
firstSheet.Range["O3"].VerticalAlignment = ExcelVAlign.VAlignCenter;
firstSheet.Range["P3"].Text = "爱上对方会5如";
firstSheet.Range["P3"].WrapText = true;
firstSheet.Range["P3"].HorizontalAlignment = ExcelHAlign.HAlignCenter;
firstSheet.Range["P3"].VerticalAlignment = ExcelVAlign.VAlignCenter;
firstSheet.Range["Q3"].Text = "235 2 ";
firstSheet.Range["Q3"].HorizontalAlignment = ExcelHAlign.HAlignCenter;
firstSheet.Range["Q3"].VerticalAlignment = ExcelVAlign.VAlignCenter;
firstSheet.Range["R3"].Text = "改进了他们";
firstSheet.Range["R3"].WrapText = true;
firstSheet.Range["R3"].HorizontalAlignment = ExcelHAlign.HAlignCenter;
firstSheet.Range["R3"].VerticalAlignment = ExcelVAlign.VAlignCenter;

firstSheet.Range["C4"].RowHeight = 25;
firstSheet.Range["C4"].Formula = "SUM(C5:C65536)";
firstSheet.Range["D4"].Formula = "SUM(D5:D65536)";
firstSheet.Range["E4"].Formula = "SUM(E5:E65536)";
firstSheet.Range["F4"].Formula = "SUM(F5:F65536)";
firstSheet.Range["G4"].Formula = "SUM(G5:G65536)";
firstSheet.Range["H4"].Formula = "SUM(H5:H65536)";
firstSheet.Range["I4"].Formula = "SUM(I5:I65536)";
firstSheet.Range["J4"].Formula = "SUM(J5:J65536)";
firstSheet.Range["K4"].Formula = "SUM(K5:K65536)";
firstSheet.Range["L4"].Formula = "SUM(L5:L65536)";
firstSheet.Range["M4"].Formula = "SUM(M5:M65536)";
firstSheet.Range["N4"].Formula = "SUM(N5:N65536)";
firstSheet.Range["O4"].Formula = "SUM(O5:O65536)";
firstSheet.Range["P4"].Formula = "SUM(P5:P65536)";
firstSheet.Range["Q4"].Formula = "SUM(Q5:Q65536)";
firstSheet.Range["R4"].Formula = "SUM(R5:R65536)";
/**********************************************************************


With the lastest Syncfusion assembly 8.1.0.30, workbook can be save!
think you again!!


WH whitebird April 1, 2010 03:29 PM UTC

there is a new problem With the lastest Syncfusion assembly 8.1.0.30.
I set FontName a chinese name, such as "隶书", and create a new Excel document,when i save and open it with Microsoft Excel,the text font don't match what i have set.
but when i preview the document, the text font is the right one.


WH whitebird April 8, 2010 03:22 AM UTC

HI!
I Have a new question.
i create a new wokBook with XLSIO, and i got the right wrkBook.
the workBook.WorkSheet.Count > 0, such as 3.
but when i run code as follow:
GridExcelConverterControl gecc = new GridExcelConverterControl();
gecc.ExcelToGrid((IWorkSheet)workBook.WorkSheets[0],gridControl.Model);
then the workBook.WorkSheets.Count =0.
why the count become zero??
thanks very much!


LR Lokesh R Syncfusion Team April 9, 2010 04:27 AM UTC

Hi White,

Thank you very much for your patience,

We are sorry for the delay caused in getting back to you.

1.Chinese Font problem(4/1/2010 11:29:29 AM)

I could not able to see the issue at my side, could you please try the modified sample, in which i have used the same font as you have mentioned in your post.

2.Worksheets Count Problem(4/7/2010 11:22:29 PM)

As you have mentioned, I could not able see any issues at my side, the worksheets count are same after using the ExceltoGrid method, i have also added this method in the below sample. Please try the sample and let us know if still you can able to reproduce the issue.

I have used 8.1.0.30 DLL’s to test this sample ,i have also attached the assemblies with the sample.

Sample link:

http://help.syncfusion.com/samples/XlsIO.Windows/93671.zip

please let us know if you have any queries.

Thanks,
Lokesh.


AD Administrator Syncfusion Team May 28, 2010 07:55 PM UTC

I'm having the same problem - it'll just say that the style named 'Normal' cannot be found.


LR Lokesh R Syncfusion Team May 31, 2010 10:12 AM UTC

Hi Jeremy,

Thank you very much for your interest on Syncfusion products.

Could you please update me with the sample code snippet and the input excel sample ,which reproduces the issue. So, that i can able to sort out the actual cause of the issue.

Please, let me know if you have any queries.

Thanks,
Lokesh.

Loader.
Live Chat Icon For mobile
Up arrow icon