Tag: PHP的

导出数据到excel表单

我已经使用了一些代码,我正在出口数据库表数据Excel表使用PHP。 但是,无论何时首先下载文件,都会打开一个错误信息,说明它不是支持的格式。 通过点击是它打开并显示我的完整数据,但在页的最后,页脚也显示。 码 <?php if(isset($_POST['download'])){ // The function header by sending raw excel header("Content-type: application/vnd-ms-excel"); // Defines the name of the export file "codelution-export.xls" header("Content-Disposition: attachment; filename=Subscribers.xls"); ob_clean(); // Add data table include 'data.php'; } 错误 在表错误 我想从Excel表中删除页脚和打开文件的错误。

如何从一个单独的PHP脚本执行一个PHP脚本,而不会丢失第二个脚本的输出?

我目前正在使用HTML和PHP来允许用户在Web表单中input信息以生成Excel文件。 提交时,表单运行一个PHP文件main.php: <?php // output headers so that the file is downloaded rather than displayed $order = $_POST["order"]; header('Content-Type: text/plain; charset=utf-8'); header('Content-Disposition: attachment; filename="'.$_POST['order'].'.xls"'); exec('php xl.php'); sleep(2); readfile('xl_template.xls'); error_reporting(E_ALL); ini_set("display_errors", 1); ?> 其中“xl.php”是另一个PHP文件,“xl_template”是我希望修改的Excel表格的模板。 main.php的目的是抓取修改后的模板并下载到用户计算机上,而xl.php实际上修改了Excel模板并将其保存到服务器计算机上(使用PHPExcel库): <?php // this file will be called by main.php // after execution, there should be a newfile.xls // for the main.php […]

你可以使用什么,而不是在tick中的刻度线?

我试图将Excel电子表格中单元格的值设置为引用工作表的公式,并具有多个参数。 我的公式是: =SUMIFS('Sheet1'!AY:AY,'Sheet1'!J:J, "Q1", 'Sheet1'!M:M, "Extensions", 'Sheet1'!AW:AW, "NP")+SUMIFS('Sheet1'!AY:AY,'Sheet1'!J:J, "Q1", 'Sheet1'!M:M, "Extensions", 'Sheet1'!AW:AW, "PHBO")+SUMIFS('Sheet1'!AY:AY,'Shee1'!J:J, "Q1", 'Sheet1'!M:M, "Extensions", 'Sheet1'!AW:AW, "PR", 'Sheet1'!AN:AN, "Both")+SUMIFS('Sheet1'!AY:AY,'Sheet1'!J:J, "Q1", 'Sheet1'!M:M, "Extensions", 'Sheet1'!AW:AW, "PR", 'Sheet1'!AN:AN, "Area") 我的PHP是: $objPHPExcel->setActiveSheetIndex(1) ->setCellValue('B2', 'XXX'); 其中XXX =上面的公式。 问题是因为公式中的“和”标记我得到错误。

“101:产品不存在”(Magento API)product.update

我看到了文档,但是我仍然没有在代码中发现错误。 我试图从excel文件添加产品到Magento系统,然后在每个商店视图 (多语言商店) 上更新它 。 为此,我已经完成了下面的PHP脚本。 在这个代码中,我只读了一个Excel行(只是为了告诉你它是如何工作的),然后我将它添加到Magento(实际上是工作 ),然后我试图更新的东西(给出错误 )。 请注意$ col [9]是保存SKU的variables。 注意:我正在使用SOAP,但不是V2。 $rowdata=$sheet->rangeToArray('A' . $row.':'.$maxcol . $row, NULL, TRUE, FALSE); $col=$rowdata[0]; //$soap is the client. $session_id is the logged in SOAP session. $attributeSets = $soap->call($session_id, 'product_attribute_set.list'); $attributeSet = current($attributeSets); $result = $soap->call($session_id, 'catalog_product.create', array('simple', $attributeSet['set_id'], $col[9], array( 'categories' => array(2), 'websites' => array(1), 'name' […]

将文件内容直接导入数据库 – 需要修复的Excel电子表格

我正在一个项目中,我直接在MySQL数据库中存储文件。 代码工作正常,存储和下载文本文件,图片和PDF,但使用Excel表格时,它有一个问题。 如果我存储一个Excel传播(.xlsx)文件,上传工作正常,但是当我下载文件,下载似乎工作正常,但是当我打开电子表格时,我得到以下内容: We found a problem with some content in 'filename.xlsx'. Do you want us to try to recover as much as we can? If you trust the source of this workbench, click Yes?' 当我按Yes我会得到以下内容: Excel completed file level validation and repair. Some parts of this workbook may have been repaired or discarded. 当这样做,Excel载入正常,一切看起来不错,但为什么我会得到这个错误,为什么需要修复。 […]

如何在PHPExcel的单元格中设置文本方向?

我必须在内联的RTL和LTR语言组合的单元格中编写文本,而先前的语言是RTL语言。 所以我需要将PHPExcel生成的xls文件中的文本默认为RTL。 我能做什么?

从HTML表单存储数据到Excel表格?

有什么方法可以存储访问者以网站forms (姓名,电子邮件,地址等)input的数据来优化数据库。 所以如果我的访问者input这些信息,他们会立即存储到excel数据库。 请给我一些教程或类似的东西,所以我可以阅读和做到这一点。 我可以使用PHP或JavaScript,没关系,我只是想知道如何做到这一点。

在网站上显示excel实时更新

我有一个连接到股票价格软件的Excel表格,因此excel表格按照股票价格软件反映实时价格。 我想使用Excel表格或单元格中的数据来反映在网站或移动应用程序。 还挺像API。 我不介意保持电脑。 API对于实时股票价格非常昂贵,我只想在我的网站或移动应用上免费显示实时价格。 我该怎么办?

PHP Excel导出只显示MYsql表的最后一行

我有问题从MySQL数据库使用模仿Excel文件的PHP脚本导出数据。 数据只是导出MySQL表的最后一行。 我删除了所有的关系查找代码(因为有多个MySQL查询通过这使得它很难阅读)。 我知道我已经写了我的variables,所以只有选中的最后一行可用于脚本,但经过大量的search,我仍然无法find答案(我猜我需要将数据存储在一个数组,然后调用将数据导出为ex​​cel文件的代码中的数组)。 所有的帮助将不胜感激。 我的代码(切碎的版本)是: <?php // Apply server security settings and keep cookies // connecting to the server // selecting the appropriate database //storing and fetching user data $generate_query = "SELECT * FROM main_report"; $generate_data = mysql_query($generate_query, $link); while($report = mysql_fetch_array($generate_data)) { $reportnoout = "<td>".$report['report_number']."</td>"; $incdateout = "<td>".$report['incident_time']."</td>"; $siteout = "<td>".$site_data['site_name']."</td>"; $deptout = […]

从SQL到Exceldate格式

我发现一个代码,帮助我得到我的数据库的Excel表,它能正常工作,除了“date”列,只是给了我#######。 这个“date”列是sqlite中的DATETIMEtypes(它默认input当前date(yyyy-mm-dd)),数据来自HTML中的inputtypesdate。 这里是我的PHP代码: <?php namespace Chirp; include "./_pdo.php"; $db_file = "./test.sqlite"; PDO_Connect("sqlite:$db_file"); $data = PDO_FetchAll("SELECT * FROM test"); // Original PHP code by Chirp Internet: www.chirp.com.au // Please acknowledge use of this code by including this header. function cleanData(&$str) { $str = preg_replace("/\t/", "\\t", $str); $str = preg_replace("/\r?\n/", "\\n", $str); if(strstr($str, '"')) $str = '"' […]