将价格表从Excel复制并粘贴到浏览器 [英] Copy and Paste Price Sheet from Excel to Browser

查看:178
本文介绍了将价格表从Excel复制并粘贴到浏览器的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个客户希望能够从excel中复制一系列单元格并将其粘贴到Web浏览器中。它基本上是一列中的产品代码和另一列中的价格。我希望能够提交这个表单来做一些php表单处理。有没有办法可以做到这一点?他希望复制和粘贴,而不是以表单格式修改价格。

解决方案

当数据被粘贴时,它将以制表符分隔。你可以让他将文本粘贴到textarea中,然后提交表单处理它。或者你可以看中并且在textarea改变时让一些javascript解析数据。如果(!empty($ _POST)){
$ b


  $ b list($ code,$ price)= explode(\t,trim($ _POST ['data'])); 
//用代码和价格做一些事情


code


$ b

编辑:

允许多行使用 explode(\\\
,$ _POST ['data']);
然后你可以遍历数组并获得单独的行。


I have a client that wants to be able to copy a range of cells from excel and paste it into a web browser. It will basically be the code of a product in one column and a price in another column. I want to be able to submit this as a form to do some php form processing on it. Is there a way that this can be accomplished? He wants to copy and paste instead of modifying prices in a form format.

解决方案

When the data is pasted it will tab delimited. You can either just have him paste the text into a textarea then submit the form where you process it. Or you can get fancy and have some javascript parse the data when the textarea changes. I'd start simple and go for option 1

if ( !empty( $_POST ) ) {

    list( $code, $price ) = explode( "\t", trim( $_POST['data'] ) );
    // do somethign with code and price

}

EDIT:

To allow for multiple lines use explode( "\n", $_POST['data'] ); Then you can loop through the array and get individual lines.

这篇关于将价格表从Excel复制并粘贴到浏览器的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆