我正在使用 Phpmailer 发送电子邮件。最初,当我通过用户名和密码使用 SMTP 时,它工作正常。如果我尝试不进行 SMTP 身份验证,则会返回连接超时错误。这是我的代码
<?php
require 'PHPMailerAutoload.php';
$mail = new PHPMailer;
$mail->isSMTP();
$mail->SMTPDebug = 2;
$mail->Debugoutput = 'html';
$mail->Host = "relay-hosting.secureserver.net";
$mail->Port = 25;
$mail->SMTPAuth = false;
$mail->SMTPSecure = false;
$mail->setFrom('xxxx@domainname.com', 'First Last');
$mail->addAddress("xxxx@domainname.com", "Recepient Name");
$mail->addReplyTo("xxxx@domainname.com", "Reply");
$mail->isHTML(true);
$mail->Subject = "Subject Text";
$mail->Body = "<i>Mail body in HTML</i>";
$mail->AltBody = "This is the plain text version of the email content";
if(!$mail->send())
{
echo "Mailer Error: " . $mail->ErrorInfo;
}
else
{
echo "Message has been sent …Run Code Online (Sandbox Code Playgroud) 我目前正在使用Apache POI 3.12添加数据透视表.这是我的sample.xlsx文件:
现在我使用以下代码为上述数据创建数据透视表.
File excel = new File("sample.xlsx");
FileInputStream fis = new FileInputStream(excel);
XSSFWorkbook wb = new XSSFWorkbook(fis);
XSSFSheet sheet = wb.getSheetAt(0);
XSSFPivotTable pivotTable = sheet.createPivotTable(new AreaReference("A3:C7"), new CellReference("E3"));
pivotTable.addRowLabel(0);
pivotTable.addColumnLabel(DataConsolidateFunction.SUM, 1);
pivotTable.addDataColumn(1, true);
pivotTable.addReportFilter(2);
FileOutputStream fileOut = new FileOutputStream("output.xlsx");
wb.write(fileOut);
fileOut.close();
wb.close();
Run Code Online (Sandbox Code Playgroud)
我的output.xlsx文件包含以下数据透视表:
当我要在excel中编辑数据透视表时,它在页面字段中添加年份列而不是列字段.其实我需要以下结果:
我无法从单列值添加多个列标签.请你帮助我好吗?提前致谢