I've created an Excel spreadsheet using Flexcel (V6.7.12) and set the print range. I've also set the print titles to print across the top and down the side of each page. If I render the spreadsheet to a PDF the print range is used but the print titles are ignored. Is there some way that these can also be output?
Print titles should be fully supported when exporting, this has been supported from the start.
I've made a simple test application here:
And as you can see, it shows the same as the Excel preview. Do you think you can modify it to show the error you are seeing or send me otherwise an example file that doesn't work so I can know what is going on?
Thanks Adrian for your very prompt reply... I'm always impressed with the quality of TMS support!
Experimenting with your example and my file I've discovered two things:
- The print title range must be included in the print range otherwise they are not printed.
- All of the cells in the print title ranges must have an entry otherwise a "Stream Write Error" is thrown.
Neither of these are an Excel requirement, but I will program around them.
About the first issue, you are right: FlexCel considers that you want to print what is in the print area. If it is outside it won't print it, so if print titles are outside the print area they will be ignored. I will be honest, this makes more sense to me than printing the print titles anyway even if they are not in the print area, but as Excel indeed behaves differently we will see if we can adapt the code to behave the same.
Note also that you can use multiple print ranges in a sheet and FlexCel fully supports that. So you could add the print titles as a separate print range, even if that wouldn't be the same as those print titles would be printed in a separate page too.
About the second issue I couldn't reproduce it. I tried with the following file instead:
And it works correctly.
There is though one known issue when printing tagged pdfs (the default) and print titles which hasn't been fixed yet. It doesn't happen in most cases, but it can for complex files. So I wonder if you set:
pdf.TagMode := TTagMode.None;
(and you also add FlexCel.Pdf to the uses list so it compiles)
Does it make any difference?
Thanks Adrian, setting TagMode stopped the "Stream Write Error". I've made some minor adjustments to your sample that causes this error and will email it to the support address. I think it is some combination of empty cells in the intersection of the top and side titles but I'm sure you'll be able to find what's causing it!