It seems that PHPExcel TYPE_LIST has a limited length.
$formula = $objPHPExcel->getActiveSheet()->getCell('A2')->getDataValidation();
$formula->setType(PHPExcel_Cell_DataValidation::TYPE_LIST);
$formula->setErrorStyle(PHPExcel_Cell_DataValidation::STYLE_INFORMATION);
$formula->setFormula1($countriesList);
The following string works in the dropdown list:
Afghanistan,Albania,Algeria,American
Samoa,Andorra,Angola,Anguilla,Antarctica,Antigua and
Barbuda,Argentina,Armenia,Aruba,Australia,Austria,Azerbaijan,Bahamas,Bahrain,Bangladesh,Barbados,Belarus,Belgium,Belize,Benin,Bermuda,Bhutan,Bolivia,Bosnia
and Herze
Althought you may have notice that the last word "Herze" is not correct. The correct word is "Herezegovina". If I try to send all the text into the dropdown it stops working.
Afghanistan,Albania,Algeria,American
Samoa,Andorra,Angola,Anguilla,Antarctica,Antigua and
Barbuda,Argentina,Armenia,Aruba,Australia,Austria,Azerbaijan,Bahamas,Bahrain,Bangladesh,Barbados,Belarus,Belgium,Belize,Benin,Bermuda,Bhutan,Bolivia,Bosnia
and Herzegovina
It seems that the maximum length is 255 and I would like someone to confirm me this? and if there's other option to show all the items as dropdown?
You can use a LOOKUP formula instead of a list
Related
In the current version of my project, I can only get a cell value using getCell("A4")->getValue(), but there's a problem, sometime I want to delete or add a column, it will disrupt other values, so I have to sort my data again.
I want to know if there is a function, that can give me cell using using a number as a column insted of a letter, exemple: "A4" from $title['first'][4], and "B5" from $title['second'][5]
image of exemple
Maybe my expression is not clear enough,I hope you can get my point/question, thanks!
$colunmn=1; //The colunmn you want to start the cicle
$columnMax=5; //The colunmn you want to end the cicle
while($coluna < $columnMax){
$colunmString = PHPExcel_Cell::stringFromColumnIndex($colunmn); //Convert the nº index into a collunm string ex: 1->'A', 2->'B', 27->'AA', 28->'AB'
getCell($colunmString. "2")->getValue(); //I used "2" as a line exemple you can change it
$colunmString++;
}
You can adapt that code to your needs.
Just use the function PHPExcel_Cell::stringFromColumnIndex( int ) to get the column string with an int index.
The title might be a little confusing, but I've got a spreadsheet generator, and in this case it's used to generate a spreadsheet to upload to Amazon, and I'm working on converting the price of the items from USD to CAD.
In my file, I store the price of my items into $price_amazon, then I multiply it by whatever the user enters and gets stored into itself. Like so;
$conversion = $row['rate'];
$price_amazon = $row['price'];
$price_amazon = $price_amazon*$conversion
#Evaluates to:
#19.99*1.24
Here's the issue, once the spreadsheet loads up, my price fields will have the correct value, in this case 24.7876 but with an asterisk at the end, so 24.7876*. All of the cells for prices have an asterisk at the end, and I'm not sure on what is going on exactly. The image below shows exactly what I'm talking about, taken directly from the spreadsheet.
Then just remove the asterix at the end of the string and convert the value to a float:
$price_amazon = (float) substr($row["price"], 0, -1);
or even just a type conversation to a float removes the asterix from the end:
$price_amazon = (float) $row["price"];
Figured out the problem. User error! Further down my script, where I'm echoing all the variables into their necessary cells, I fat-fingered the asterisk key attempting to do God-knows-what. Here's what it looked like
echo "<table>\n";
echo "<tr>
<td>$price_amazon*</td>
As you can see, such a very easy mistake to make and hard to find, but this was definitely a case of user error. I appreciate everyone taking the time to help resolve my issue when in the end, the issue was me!
I am using Vtiger 6.3.
I need to remove the ellipsis from the organization (контрагент) text field and render the full name of organization. Please see the screenshot below.
[
I found a CSS file and commented out all styles but the dots are still present.
I went deeper into the PHP files and found that Vtigercrm gets the data from the database and parses it in its code. But I can not see where it formats the text.
Where can I find it?
I hope you are talking about values which get trimmed after certain length in List view of Module.
The function which doing this trimming is called function textlength_check($field_val) and its present in vtiger_root/include/utils/ListViewUtils.php,
Trimming happens in this function function getListViewRecords($focus, $module, $result) and its present in this file vtiger_root/include/ListView/ListViewController.php, Also have a look on line number 364(vtiger 6.4), they are doing it as custom for multipicklist,
You can also increase the size of listview value by changing this $listview_max_textlength = 40; (Default length is 40)configuration in vtiger_root/config.inc.php
HTH
I am getting a variable from a socket. After reading the respond I am trying to convert the value to a number. if I print the respond it looks correct however when I convert it to number using floor() it doesn't give me the right answer. I also tried to print the length of the variable and it is still not working as it suppose to: This one is for value :185
echo("**************** ".floor($res[0]));
echo "################### $res[0]";
echo "------------- ".strlen($res[0]);
output:
**************** 1################### 185------------- 12
I have also tried stripslashes, trim and also ereg_replace('[:cntrl:]', '',$res[0])
Please try the following: intval($res[0])
You can try also with:
$res = (int)$reg[0];
Hope this helps.
Bye
Ok I found the problem. I saved the value in a file and opened the file using notepad++. I saw the following character in between my string:
SOH,NULL, and bunch of other non character values
What I am assuming is PHP automatically ignore the ASCII values are not show able on the screen (less than 21Hex).
I am parseing a page and saving the retrived data in mysql db. Everything is ok except the price of the product. After extracting price,when i use print_r($price) i get the actual value but while saving the same $price in my database, i get only a part of it.
for example:-
while using print_r($something); //output is 2 458
while saving in database $something, the saved value is only 458.
I think that the problem is due to space between 2 and 4. I can understand that this is a very simple question for most of you, but right now i am not able to solve it.
Thanks a lot ahead for support!
MySQL is pretty permissive about what data you can insert into its fields. In this case you are trying to insert a string that contains two numbers into a numeric field, it's doing its best to extract a single number from that data but is getting it wrong.
All you need to do is remove the space(s) before you insert:
$something = str_replace(' ', '', $something);
or using a regular expression you could remove any non-numeric character:
$something = preg_replace("'[^0-9]'", '', $something);