In SSRS is there a way to copy formatting between cells? - sql-server

I am developing several dozen reports in SSRS 2008 R2. I am finding the formatting of cells to be the most tedious and error prone part of the task. I know how to individually format each cell.
Is there a way to copy the format of one cell to many other cells?
I would like to avoid doing search and replace in XML, but I am open to it. My dataset queries are parameterized MDX.
Is it possible to format an entire column at once? Or do you always have to format each individual textbox in a column? Is there a way to specify default formatting for each textbox?

Working on the assumption that you're right-clicking each Text Box and using TextBox Properties to edit the formatting options:
If you go to the View menu in BIDS and select Properties Window, you will get access to all properties of each object at once (in my BIDS it displays below the Solution Explorer on the right).
Assuming you're talking about a Tablix control within a report here, You can format an entire column simply by clicking the column header and editing the formatting options in the Properties Window.
When it comes to say 4 or 5 cells together but not an entire column/row, you can shift-click to allow you to format multiple cells in one go.
I.e. click Cell 1, hold down shift and then click Cell 4. The Properties Window will then let you edit all the cells in the selected range.

Riffing off of GShenanigan's answer, it depends on what you mean by formatting. If it's things like color, font, etc, then you could define a variable, set it to the value that you want, and then set the value of the property for the cell(s) to the value of that variable. For instance, let's say that you're going to set all of the cells' font to Courier New. You'd define a variable called "Font", set it to "Courier New", and then for each cell that you want to have this font, you'd set it's value using an expression which evaluates that that variable's value. Then, when the requirements change and all of those cells need to be Arial now, you change it in one place (the variable) and all the formatting changes.

My solution was to highlight all cells in the table that I wanted to change. Then click View to display the Properties box. Go under the Properties box, in the Number section and change the Format. This worked and reformatted all cells as I wanted.
As a note, I had to paste in the format that I wanted from one of the cells that I had already changed.

Steps:
1. Format one textbox with your desired format
2. Select that cell and check its property window and in "Format" area you will see some code
3. copy that and select other textboxes you want to format with same format.
4. paste the copied value in format area of these newly selected textboxes.
5. Finished.

Highlight cells you want to change and set the font using the Report Formatting toolbar. This worked for me after not being allowed to type in the Properties side pane and having the Properties option disabled on the context menu.

You can format a column or a row depending on what conditions you will require for the formatting.
Let's look at the different scenarios (assuming you are using Visual Studio /BIDS:
If all your columns or rows use similar conditions for formatting
you can select the entire row or column => go to properties window => write an expression for the formatting
If a portion of your columns require use similar conditions for formatting, you can pick those columns by using the control key and clicking on these columns and apply the formatting as explained above
If each cell's formatting is based on individual conditions (e.g., you evaluate the data from that cell to format that cell), you either format particular cells or write an external script code

Related

Autofilter by DisplayText in DevExpress

I have a calculated numeric field in a grid. I use a custom editor for it. All filter operations in Filter editor work well but the auto filter row filters according to the value and not the display text. I know that I can set FilterMode to DisplayText but then this is also used for comparisons etc. So, I need to use FilterMode DisplayText for the auto filter, Value for everything else. Is this possible? I have already a lot of code in the custom grid class, so it would be ok to have an additional event handler or another workaround.
EDIT
I store e.g. prices in euro and I display them differently depending on the user's settings. So, e.g. I have stored a value 100 and I need to display "234 abc". When I set FilterMode=DisplayText, I can't compare the actual value with e.g. > and <. Currently, I use FilterMode=Value and I convert the displayed value in the filter editor for filtering. The only problem is with StartsWith i.e. auto filter and with = because of rounding. How could I fix that?
I found a solution for my issue... As I have no control on how exactly the values are filtered and I had couple of problems with filtering, I converted my bound columns to unbound columns. I removed the editors making the conversions and replaced them by unbound expressions with custom functions + display format. Not really the solution I was searching for but it works for all kinds of filtering.

XAML - Access an array value from a template, indexed by the containing column position

I have an desktop WPF application that shows values from different files, the objective being to compare those files. The values extracted from the files are displayed in a DataGrid, one column per file. The user can add or remove files at will, which means that the amount of columns displayed in the grid can change. Columns are created and removed from a ViewModel, and have complex content that requires the use of DataGridTemplateColumn instances.
The data source is basically a two dimentionnal array (something like ObservableCollection<ObservableCollection<CellViewModel>>).
To fill my cells I need a data template, but the problem is that the DataTemplate's data source will be the row. And if I want to display the correct value, I'll have to know the index of the current cell from the template, so I access the correct index in my row. In the end, I'd like to be able to have a binding in the template that looks like {Binding Path=[someIndex].DisplayText} (DisplayText being a property of my CellViewModel).
I hope I've been clear enough :)
So the question is : how do I read the correct index in my row from the template ? Or, is there some better way to handle this variable-sized templated columns list problem ?
Thanks

adding checkbox to ssrs tablix that will be manually clicked

I have created a stock taking report in SSRS 2008. I have also added an extra column in the tablix.
The extra column I added is a column I want to have the option to manually click on the checkbox if item is in stock.
I have tried using the wingdings option using the below expression:
=iif(Fields!Expr1.Value,chr(252),chr(251))
However the result I get is not the desired result, because I get about 6 winging characters back instead of the check and uncheck boxes I required
How could I go about fixing this ?
One option is to use an Indicator, but I've preferred to use images for similar situations. Embed the two needed images in the report and switch between those dynamically. (You can make standard images of your characters in MS Paint or Paint.NET.)
Images have the disadvantage that they don't print with high resolution, but they do render on most devices (not .csv) and you don't need to worry about installed fonts on the server.
As far as fixing your immediate problem, try changing the "Markup Type" for your placeholder (Placeholder Properties -> General -> Markup type.) It sounds like something is trying to generate HTML when it shouldn't be.

wpf datagrid copy and paste what you see

I am using data grid in wpf, and it has copy and paste by default.
I have a date time column and i used binding and String format to make it show it in the date time format i want.
However, when i copy and paste, the pasted text becomes the unformatted date time.
Is there a way to do a copy a paste on "What you see is what you get?"
Thanks, Kev
Edit: I tried using ClipboardContentBinding, putting same thing as i did in binding. And that didn't work
DataGrid has a number of clipboard extensibility points you can hook into and see what is going on. The grid itself has a CopyingRowClipboardContent event that apart from having all the needed information in the event arguments has a nice helper method FormatClipboardCellValues(string format). Also each column has a CopyingCellClipboardContent which can be used for your particular data time column needs.
Note: By default DataGrid's bound columns (those deriving from DataGridBoundColumn) will have them ClipboardContentBinding pointing to the Binding property if not specified explicitly.

How to change all highlighted rows in DataGridView - VB.NEt

Begginer's question. I'm trying to write small piece of code in Visual Studio (VB.net) that will change value of a particular field of the database for all highlightetd rows. So, I'm running my form, which displays some data from the datatabse. I then highlight some rows (holding Ctrl and clicking). Next I click a button that will trigger a value change for all the highlighted rows (only). Say, I want to change the "Name" column's value for all of them.
Hope this makes sense. Thanks!
Damo
The DataGridView.SelectedRows property contains a collection of all of the rows that the user has selected. You can spin through this collection and do what you wish with each row.
See this article for more information and example code.

Resources