How to "format as table" in Excel or apache POI? - excel

In Excel 2010 it's possible to "format as table" a group of cells - enabling easy sorting and filtering (Home > Format As Table).
Can I do the same in Apache POI? Alternatively, can one accomplish the above directly in Excel via a macro/formula (as opposed to CTRL+T or clicking on a toolbar button)?

There's a fairly new feature in POI that may deliver what you need. Grab a recent nightly/svn build (or wait for POI 3.8 beta 3 in a week or so), and take a look at XSSFTable. You should now be able to add one to a sheet, specify the range it applies to (the range you want to be made a table), and that hopefully will do you. It's quite new though, so you may need to join the POI dev list and help with the development of the feature if it's not quite there for you!

Related

Analysis Services: How to show the original parameters of Pivot Table Excel after computing filter?

When connecting to AnalysisService / Cube with Excel, I have a PivotTable in a Excel Tab.
Here it is.
And the PivotTable settings is in the Sheet1
THEN I do double-click in the corresponding cell where excel tells me "DOUBLE CLICK"
What I am trying to say is that I can perform many Pivot Table and filters, and excel creates, for every settings, a NEW TAB after I perform also the Double-click.
Ok.
But then, how I recall again the original settings for each Excel TAB ?
What is the way to show the originals parameters for every Tab, in Excel, that were used to compute and search or filter some results ?
Maybe there is not a way.
Microsoft® Excel® for Microsoft 365 MSO
Version 2111 Build 16.0.14701.20278) 64-bit
The results in a Excel TAB (Just an example) after doing the double-click to compute the fields putted in the PivotTable
The question is. How, from the results, I can return back to the original settings that originated the table data ? If I don't remember the original parameters that I've put, how I see them again, FOR EVERY TAB ?
If it's not clear, please let me know in the comments
Thanks !
once the query is submitted, there's noway to see the original filter.

Copying Columns within a library in Sharepoint

I am trying to copy two different columns into two different named columns in a sharepoint library(doc type -> acc doc type & series -> series name) Currently I have been highlighting and then using the drag option into the second column, but that is very inefficient as you cannot use it when you highlight the entire column, as well as there often being several hundred files per library. Is there an easier way to copy the columns? Much appreciated!
Note: the new columns im trying to copy them into are global columns so i believe making new ones will not solve my problem.
I believe what you are looking for is Datasheet view (SharePoint 2010 and earlier versions), or, in SharePoint 2013 (which it sounds like you are using) it is called Quick Edit.
In any document library, click on the library tab in the ribbon and then Quick Edit. This will take you to a view that allows you to manipulate the metadata as you would in excel, e.g., copying and pasting large amounts of data at a time.

PostgreSQL: Copy/paste resulting with headers into Excel without code

I used MS SQL Server 2008 R2 (MS SQL) where I could right click the query result, copy/paste it with headers to Excel for easy exploration. Now with PG Admin (PostgreSQL) I have to do export (File > Export > CSV) then bunch of Excel steps (Text To Columns).
Is there an easy way to copy/paste the query result with headers into Excel?
For pgAdmin 4, there is an option to "Copy with headers". It is a drop-down beside the copy button in the Query Tool menu:
PgAdmin seems to make semi colon the default field separator. Excel seems to like tabs by default.
You could try and change excel or each time just do the "text to columns" feature.
I personally would go to Preferences->Query tool->Results grid and change the following
Result copy quote character: "
Result copy field separator: Tab
Copy column names: True
This will make it more behave more like sql management studio.
There's a lot of different ways to accomplish what you want here. The question is a bit confusing because you are talking about Excel, but then you table about '/var/lib/postgres/myfile1.csv', which makes me think you are now using some favor of Linux.
I'm using Ubuntu 12.04 with pgAdminIII 1.16.0. And I have Open Office installed with LibreOffice 3.5.4.2 as the Excel replacement.
I'm not sure why you want to take the information out of the grid in pgAdminIII, but assuming just wanting to take the data and move it over to a spreadsheet to play it for some reason, then about the easiest way to do it is run your query and click the upper left corner of the results (which just like a spreadsheet selects everything) and copy. Then, you should be able to open LibreOffice and paste in the information. It will bring up the same dialog as you would see when importing a CSV file.
Also, you should be able to start psql and then do a "COPY" command. If you get a permissions error, then try the suggested "\COPY" instead. Please see the PostgreSQL docs. Here is a link to a wiki page here.
If I'm missing what you are trying to do, please ask questions in the comments section, and I'll try to improve my answer accordingly.
You have to set your query tool output to text not the grid data. That way the Column names and the query results are all in the same cut past text file. When you do this you are no longer doing CSV. The whole results and field names comes over as a text file in the cut and paste process.
Answering to quite an old post:
The answer by #Phillip Fleischer seems to be the best way, at least in pgAdmin III. But for pgAdmin III version 1.22.2 (the one I am using), instead of Preferences..., the settings mentioned were seen under File > Options > Query tool > Results grid.

default value to a cell of a new row without a macro (Excel)

I would like to insert a default value, to a specific cell in my worksheet,
but this default value should take care of new rows inserted in the worksheet.
I must not use a macro for this.
thanks
Maybe I am wrong, but I can not think of any way, one would be able to that. This is more a typicall database functionality. Without macros you would have to use a function or a format. A function, like values, would not be copied by inserting new rows - only formats would, so this narrows it down.
By the way, I interpreted your question to "default value on instertion of new row", not "default value when writing data in a existing clear row".
So, as a kind of "default value behaviour" you could use user defined cellformats.
i.e. use ;;'x'; as a user format and format your cell or column with it. This won't fill empty cells with 'x' but, whenever you would type in '0' it would change to 'x'.
However, I am very interested, if there is a better solution.
You can add validation to cells which can help you force a number into a particular cell, but as stated in the earlier answer a database is more designed for Default Values.
It seems to me you are trying to create a database in Excel, I wouldn't recommend this as excel is very good at prototyping algorithms however when it comes to structuring tables it can fail very quickly.
Use at least MS Access, namely as it comes with a database. Alternatives are rapid prototyping tool such as Eclipse or Netbeans, or Visual Studio if your budget can stretch that far. Couple the RAD tools with MySql (namely for ease of use and the fact that the community licence is good) and the system should be stable.

is specifying a cell's color (in an excel spreadsheet) by its very textual content possible?

you can fill a cell with '=cos(0)' and you get displayed its value '1'.
is there some similar function(ality) to choose the font-color?
something like '=COLOR(the text to display, #FF0000)'.
if not, how could you achieve something like that?
here is where I come from: I write data to an excel-file (using KNIME btw) and I want to choose the font-color.
When this question was raised in the Knime forums a couple of months ago, it didn't elicit much response, so I suspect the answer is simply "No". There were plans back in 2007 for Knime to start using Apache POI to write Excel files, which should have allowed formatting, but I don't know if this ever happened... if it didn't, then Knime is probably still just writing a CSV file for Excel, which doesn't support any formatting.

Resources