Error with 'PrintTitleRows'- 'PrintTitleColumns' and 'PrintArea'

I’m using Aspose.Excel 2.8.6.1 and I’m having problems if I use one of the following properties in a Workbook with 10 or more worksheets:

- PrintTitleRows
- PrintTitlecolumns
- PrintArea

Concretely, when I try to open the resulting file excel shows the following error:

"Conflicto de nombres: El nombre no puede ser el mismo que el documento integra."

The error appears in Spanish language because I’m using the Spanish version of Excel. Translated to English, approximately this error means:

"Naming conflict: The name can not be the same than the integrated in the document"

To reproduce the the problem you can use the following code:

Dim exce As New Excel
Dim i As Integer

For
i = 0 To 8
exce.Worksheets.Add()
Next<?xml:namespace prefix = o ns = “urn:schemas-microsoft-com:office:office” /><o:p></o:p>

For i = 0 To exce.Worksheets.Count – 1
exce.Worksheets(i).PageSetup.PrintTitleRows = "$1:$8"
Next<o:p></o:p>

exce.Save(“c:\test.xls”)
<o:p>
Please, can you help me?

Thanks in advance.</o:p>

We found this problem in some earlier version and have already fixed it. Please download and try v3.1.1 at

Hi Laurence,

We have donwloaded the version 3.1.1 and the error message continues appearing.

If you execute our sample (previous post) you can reproduce the problem (remember the error appears when the file is opened by excel)

Best regards

Actually I tested your code and didn’t find any problem. Please open the file in your machine and see if the errors also occurs?

If you still meet error with this file, could you please use MS Excel to open and save it as a new file and post it here? After saving it in MS Excel, I think this error will be solved. I will check the file and figure out the difference.

Hi Laurence,

I think you have forgotten to attach the file.

I have generated a file (using the code of the first post) and I’m attaching it (If I open this file with a Spanish version of Excel the error appears).

Best regards

Sorry for not attaching the file. Please try the attached one.

I opened your file and didn’t find any problems. I think that’s a problem of language version.

Could you please post a file without problem in your machine? Thank you.

Hi Laurence,

I have opened your file and it opens correctly (without the error).

How should I generate the file without problem?, manually from excel? (without use aspose.excel).

My file is also created with Aspose.Excel. Please try the attached program.

Dim exce As New Excel()
Dim i As Integer

For i = 0 To 8
exce.Worksheets.Add()
Next

For i = 0 To 9
exce.Worksheets(i).PageSetup.PrintTitleRows = "$1:$8"
Next

exce.Save("c:\nametest.xls")

Hi again Laurence

I have tested your code and the error message contunues appearing.

What can I do?

Please use MS Excel to create a same Excel file without this error message in your machine. Then post it here. I will check the difference. Thank you.

Hi Laurence,

Here you have the file.

Please try the attached fix.

If the error still occurs, please post the file created with the new dll. And please tell me the result of following code:

CultureInfo culture = CultureInfo.CurrentCulture;
Console.WriteLine(culture.ThreeLetterISOLanguageName);


Thank you.

Sorry, wrong version. Try this one, please.

Hi Laurence,

It works!!,

Thank you.

@e.boadaa3software,
Aspose.Excel is discontinued now and no more under active development. It is replaced by Aspose.Cells that is much advanced and rich in features. You can configure the page setup in detail as compared to its predecessor. Here is an example using the new product Aspose.Cells for setting different properties of page setup.

// Open the template workbook
Workbook workbook = new Workbook("Sample.xlsx");

// Accessing the first worksheet in the Excel file
Worksheet worksheet = workbook.Worksheets[0];

PageSetup pageSetup = worksheet.PageSetup;

// Specifying the cells range (from A1 cell to E30 cell) of the print area
pageSetup.PrintArea = "A1:E10";

// Defining column numbers A & E as title columns
pageSetup.PrintTitleColumns = "$A:$E";

// Defining row numbers 1 as title rows
pageSetup.PrintTitleRows = "$1:$2";

// Allowing to print gridlines
pageSetup.PrintGridlines = true;

// Allowing to print row/column headings
pageSetup.PrintHeadings = true;

// Allowing to print worksheet in black & white mode
pageSetup.BlackAndWhite = true;

// Allowing to print comments as displayed on worksheet
pageSetup.PrintComments = PrintCommentsType.PrintInPlace;

// Allowing to print worksheet with draft quality
pageSetup.PrintDraft = true;

// Allowing to print cell errors as N/A
pageSetup.PrintErrors = PrintErrorsType.PrintErrorsNA;

// Setting the printing order of the pages to over then down
pageSetup.Order = PrintOrderType.OverThenDown;

// Save the workbook
workbook.Save("PageSetup_Print_out.pdf");

Refer to the following document for more details:
Page Setup and Printing Options

Download the latest free trial version here for testing this code:
Aspose.Cells for .NET (Latest Version)

A detailed runnable solution is prepared which can be used to test the product features without writing any code. It can be downloaded here.