
게시판 내용을 엑셀로 다운받게 작업 했는데요. 행과 열의 순서를 바꿀라면 어떻게 수정해야 될까요?
값은 list.skin에서 가져오고,
엑셀 조정은 다른분께서 작업하신 소스를 다운받아서 했습니다.
디자인으로 수정할려고 했으나, 리스트의 구조가 바뀌어서 잘 안됩니다.
근데, 소스를 도통몰라가지고 어디를 손대어 될지 모르겠습니다.
//table2excel.js
;(function ( $, window, document, undefined ) {
var pluginName = "table2excel",
defaults = {
exclude: ".noExl",
name: "Table2Excel"
};
// The actual plugin constructor
function Plugin ( element, options ) {
this.element = element;
// jQuery has an extend method which merges the contents of two or
// more objects, storing the result in the first object. The first object
// is generally empty as we don't want to alter the default options for
// future instances of the plugin
//
this.settings = $.extend( {}, defaults, options );
this._defaults = defaults;
this._name = pluginName;
this.init();
}
Plugin.prototype = {
init: function () {
var e = this;
var utf8Heading = "<meta http-equiv=\"content-type\" content=\"application/vnd.ms-excel; charset=UTF-8\">";
e.template = {
head: "<html xmlns:o=\"urn:schemas-microsoft-com:office:office\" xmlns:x=\"urn:schemas-microsoft-com:office:excel\" xmlns=\"http://www.w3.org/TR/REC-html40\">" + utf8Heading + "<head><!--[if gte mso 9]><xml><x:ExcelWorkbook><x:ExcelWorksheets>",
sheet: {
head: "<x:ExcelWorksheet><x:Name>",
tail: "</x:Name><x:WorksheetOptions><x:DisplayGridlines/></x:WorksheetOptions></x:ExcelWorksheet>"
},
mid: "</x:ExcelWorksheets></x:ExcelWorkbook></xml><![endif]--></head><body>",
table: {
head: "<table>",
tail: "</table>"
},
foot: "</body></html>
답변 2개 / 댓글 3개
행과 열의 순서를 바꿀라면 <---이게 무슨 말인지
개인별로 한 행씩 결과가 나와야 하는데 행과 열을 바꾼다는 것은??
답변에 대한 댓글 3개
답변자는 딱 3명 고정인가요?
질문이 100개이고 답변자가 200명 이면??
--------------------
더우기 위 소스로는 설명이 안됩니다
그누보드에서 사용하는 PHPExcel 모듈을 이용하면 직관적으로 데이터를 셀에 넣을 수 있습니다
사용법은 구글검색해서 익히세요(셀 크기, 배경색, 글자색 등 지정 가능)
$list만 만들면 셀에 값을 넣는 예제는 아래 처럼 간단 합니다
$objPHPExcel->getActiveSheet()->setCellValue('A1', '제목');
$objPHPExcel->getActiveSheet()->setCellValue('B1', '이름');
$objPHPExcel->getActiveSheet()->setCellValue('C1', '날짜');
$cnt= count($list);
for($i=0; $i< $cnt; $i++){ $k=$i+2;
$objPHPExcel->getActiveSheet()->setCellValue('A'.$k, $list[$i]['subject']);
$objPHPExcel->getActiveSheet()->setCellValue('B'.$k, $list[$i]['name']);
$objPHPExcel->getActiveSheet()->setCellValue('C'.$k, $list[$i]['date']);
}
html을 자바스크립트(jquery)를 이용해서 다온로드할 수 있게 하는 것 같은데
아예
테이블을 만들 때 (php에서)
가로 세로를 바꾸는 건 어떨까요?
답변을 작성하려면 로그인이 필요합니다.
홍길동 김00 이00
제목1 답변1 답변1 답변1
제목2 답변2 답변2 답변2
제목3 답변3 답변3 답변3
제목4 답변4 답변4 답변4