Php Excel Number Formatting - phpexcel

I have this code to format the cell in number format,
$objPHPExcel->getActiveSheet()
->getStyle($colmun_alpha[$total_head+1].$row_total)
->getNumberFormat()
->setFormatCode('#,##0.00');
The problem is, it is working with other cells but with other cells, it does not work.
It gives me an output of ###### inside the cell. as you can see in the screenshot.
Screenshot here.
I was wondering what seems to be the problem since I used the same code to format other cells as you can see. If you hover in the #### you can see the value but not displaying like others.
Thanks for the help guys.

Related

How to make a whole column have the same text in google sheets

I want to have all of the cells in the "subject" column to have the same text as the second cell down. I want to be able to just edit that cell and have all the other cells edited as well without copying and pasting. this is to do mass emails for my business so formatting is essential. screenshot example below. screenshot of example
I found the answer on my own. you type in the cell that you want the text copied into with the coordinates of the one you are copying eg. "=D2" In this case, I used $ symbols so that when I copied it all the way down it would keep the current coordinate. the function ended up being "=$D$2" all the way down the column.

Adjust Rmarkdown's inline chunk output - increase no. of columns displayed?

This is a workflow related question. I'm trying out working only (or mostly) in the Rmarkdown source window with the options set to "Chunk output inline". So with R open, there is just one big window -The environment, Console and File windows being minimized.
My question: Is there some option to change the number of columns displayed? I want to increase the numbers of columns visible without scrolling (see screenshot below), and since there is enough space I think it should be possible to display more of them.
Many thanks!
Solution: There is an option. Just add cols.print = 12 (or whatever number you want) to global options.
Also, people might find this 'manual' on markdown useful: https://bookdown.org/yihui/rmarkdown/html-document.html#paged-printing

R Markdown, GGplot showing up above header

I know that its best to include a reproducible example, but I'm not sure how I would do that in this instance and unfortunately the data and rest of the .rmd document includes some PHI so I can't include that, but hopefully you can still help me:
I have a document I'm knitting to PDF in R. Here is a screenshot of my code with the headings above the graph:
When I knit it, here's the output:
I.e. the graph is showing up above the "Count" heading. What the heck? I've tried various odd formatting tricks (adding blank line in between by Visuals header and my count header, etc..) and nothing.
The graph right below it has the same problem (Percent graph is above percent heading), but all the rest of the graphs in my document (18 page pdf) show up where they are supposed to, and here is my code at the top of the document:
Anyone experienced something similar? Any idea where to even start fixing it?

How to edit legend labels in google spreadsheet plots?

I'm trying to plot some data in Google spreadsheet:
And as you may see all of the series are in a same column and I can't use the any of the rows as headers. My plot looks like this:
I would appreciate if you could help me know how I can edit/add legend labels.
Unfortunately I don't think the graphs were intended for your data format.
The only way I've been able to work out how to add a header is by reformatting my data so I have the header at the top of my ranges.
So I suggest you split your data into separate columns so you have;
D2:D4, E2:E4, F2:F4 etc with D1, E1, and F1 as your header and then selecting "Use row 1 as your headers." From the data menu.
Alternatively, you could add labels to the series themselves. Although not ideal, it could be quicker than reformatting your data. On the data menu, click on the three dots of a data series to bring up a menu that allows you to add a label. Unfortunately this needs to be a cell so you'll have to have that header on your sheet some where.
I had the same question this year (2021), and it looks like there's support for it now. In short, you just have to double-click on the empty legend item for the series, and it'll give you a place to put text, directly in the chart.
Here's what my chart looked like (with no series titles):
If you double-click on one, you'll get a small text input area.
Type in your series name and then press enter or click outside of the input area.
Repeat this for each series, and you should be good to go.
I had the same problem because I was selecting only the data I wanted to include in the chart and not the entire table, headers and all. When you create a chart in Google Sheets and you want to use a row or column (or both) as strings that are included in the chart's labeling, you must select the entire table before choosing the Chart command from the Insert menu.
After doing so, you may need to do all or some of the following:
Switch rows/columns if your axes are not correct
Eliminate any rows/columns that you don't want represented by editing the Data Range field in the chart editor
Select Use column A as headers or Use row 1 as headers
You could also potentially use the add labels option when clicking on the 3 dots in the series section:
Double-click on the symbols in your legend, then double-click on the symbol for the series you would like to label; you should be able to directly enter your legend label now. You can do further text formatting using the chart editor on the right.
I took them to a new sheet. first selected only the X-axis and one of the columns that will appear as one. label. In this sheet, I made all the "labels" as a header of the sheet. and added them one by one as a series. and this time it. add them as a label.
obviously this is a workaround and the bug should be fixed :) hopefully.

PHPExcel: how to get hidden cell values / Scientific Number in Number?

In PHPExcel is there any format available to get proper reading of the order item value as shown in picture.
I read whole the document but not find any solution for this problem.
For the date filled also if the data is shown ###### like way then how to get that as well?
In MS Excel, numbers that are larger than a certain size will be shown in scientific format (e.g. 1.40E+15) unless you set a format mask for that cell which says otherwise. The solution is to set an appropriate format mask, or to set the value as a string value.
In MS Excel, if a string value is wider than the column size, then it will be shown as ######. The solution is to increase the column size.
EDIT
I can't tell you what the best column size is? That all depends on your data.... but you can either set columns to a fixed size using:
$objPHPExcel->getActiveSheet()
->getColumnDimension('D')
->setWidth(32);
or set a column to autocalculate the width
$objPHPExcel->getActiveSheet()
->getColumnDimension('D')
->setAutoSize(true);
Exactly as described in the PHPExcel docs
Note that we do spend time and effort writing this documentation to try and answer your questions: it is worth reading.

Resources