I have a treelist control bound to a data source. Some cells in the treelist have special formatting like underline, italic, bold, back color, fore color, and row height. When I export the treelist to print or to Excel I expect it to retain the formatting, but it doesn't. I also have a special XtraReport report I use for a "finished" report that includes header and footer, etc. The export results there are the same - no formatting is retained.
This used to work fine but doesn't work now. No code changes were made between when it worked and when it didn't. One of my customers just reported it, but they had not upgraded our product since last February. I just upgraded them this week. So I have no idea when it stopped working. I can only conclude that it is a bug introduced in a more recent version of the TreeList control. Until the last few months I have always immediately installed the latest version of DX. So I know it worked in whatever version of DX that was out on 3/7/2011.
Attached is a zip file with a sample project with a treelist bound to a data source. I make format changes for underline, foreground and background to specific cells. I have buttons that send the treelist to a printer, to Excel, and to a report object that prints to Excel. The output XLS files get written to the executing assembly's folder.
Please note that in this sample app and in my "real" app I don't explicitly set up columns. On my "real" app I can't because the columns in the treelist are variable (it's a report generator where the columns are defined by the user). I simply bind the data source to the grid and manually set column widths to fit their contents.
Also in the attached zip file are the following files:
1. BEFORE - GL Report - Print Preview.png - A screenshot of the Print Preview screen for a report I took a while back when the formatting was being honored. Unfortunately this screenshot does not show blank lines and thin solid lines (explained below).
2. NOW - GL Report - Print Preview.png - A screenshot of the Print Preview screen for a report I took today where the formatting is not being honored. See note on Empty/Solid Lines below.
3. Export TreeList.xls - A sample export XLS file from my "real" app (it's all fake test data) that was exported with a simple ExportToXLS command on the TreeList control. See note on Empty/Solid Lines below.
4. Export Report.xls - A sample export XLS file from my "real" app (it's all fake test data) that was exported through a report the same way the sample app does it (i.e. it uses a WinControlContainer object). This is the method DevExpress pointed me to in a support ticket I submitted a long time ago. See note on Empty/Solid Lines below.
5. Program Screen.png - A screenshot of the program screen - just the treelist control.
NOTE on Empty/Solid Lines: You can see that I have rows with either "[Empty Line]" or "Solid Line". In the treelist, the former are formatted with fore/background colors of white so the line appears blank, while the latter are formatted with fore/background colors of black and have a custom height set so they look like a heavy bold line all the way across the treelist.
I need to know how to get the formatting to carry over in the three scenarios like it used to be able to:
1. Print treelist directly to printer.
2. Print treelist to print preview, XLS, HTML, etc.
3. Print treelist as part of a defined XtraReport embedded into a WinControlContainer object.
For the XtraReport, I'm not hung up on using WinControlContainer. If there's a better way, I'm open to it.
Thanks in advance for your help. This is very important and kind of time-sensitive, but I don't want to abuse the "urgent" option.
Is your intention to post an answer to your own question?
- If so, then proceed.
- If you simply wanted to post additional information, ask for further clarification, or to just say "Thanks!", please click Leave a Comment.
- If you wish to edit your original question, please use the Edit button in the Toolbox at the top right corner of that entry.