我想让第一排的细胞变得粗体.
这是我为此目的创建的方法.
function ExportToExcel($tittles,$excel_name)
{
$objPHPExcel = new PHPExcel();
$objRichText = new PHPExcel_RichText();
// Set properties
$objPHPExcel->getProperties()->setCreator("SAMPLE1");
$objPHPExcel->getProperties()->setLastModifiedBy("SAMPLE1");
$objPHPExcel->getProperties()->setTitle("SAMPLE1");
$objPHPExcel->getProperties()->setSubject("SAMPLE1");
$objPHPExcel->getProperties()->setDescription("SAMPLE1");
// Add some data
$objPHPExcel->setActiveSheetIndex(0);
$letters = range('A','Z');
$count =0;
$cell_name="";
foreach($tittles as $tittle)
{
$cell_name = $letters[$count]."1";
$count++;
$value = $tittle;
$objPHPExcel->getActiveSheet()->SetCellValue($cell_name, $value);
// Make bold cells
$objPHPExcel->getActiveSheet()->getStyle($cell_name)->getFont()->setBold(true);
}
// Save Excel 2007 file
$objWriter = new PHPExcel_Writer_Excel2007($objPHPExcel);
//$objWriter->save(str_replace('.php', '.xlsx', __FILE__));
$objWriter->save($excel_name.".xlsx");
}
Run Code Online (Sandbox Code Playgroud)
问题出在输出excel文件中,单元格不是粗体.
我想从表中选择一个字段并将其子串.
例如:
VAN1031 --> 1031
Run Code Online (Sandbox Code Playgroud)
我试过这个,但语法不正确:
SELECT SUBSTR(R.regnumber,3,3) from registration R
Run Code Online (Sandbox Code Playgroud)
如何才能做到这一点?
嗨在我的c#应用程序中,当表单关闭时,我正在尝试最小化应用程序到系统托盘.这是我试过的代码.
public void MinimizeToTray()
{
try
{
notifyIcon1.BalloonTipTitle = "Sample text";
notifyIcon1.BalloonTipText = "Form is minimized";
if (FormWindowState.Minimized == this.WindowState)
{
notifyIcon1.Visible = true;
notifyIcon1.ShowBalloonTip(500);
this.Hide();
}
else if (FormWindowState.Normal == this.WindowState)
{
notifyIcon1.Visible = false;
}
}
catch(Exception ex)
{
MessageBox.Show(ex.Message);
}
}
Run Code Online (Sandbox Code Playgroud)
我正在调用形成结束事件的方法.但问题是它不能最小化托盘.它只是关闭表格.
大家好,我有一个联系表格,验证码就在那里.我希望在提交表格后检查支票.我发布了文本框值,它显示正确但复选框不起作用.这是我的代码.
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org /TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Untitled Document</title>
</head>
<body>
<form action = "" name="frmSubmit" method="post">
<input type="checkbox" name="txtCheck" value="<?php echo $_POST['txtCheck'];?>" /><br />
<label>Name</label><br />
<input type="text" name="txtName" id="NameTextBox" value="<?php echo $_POST['txtName']; ?>" />
<br />
<label>E Mail</label><br />
<input type="text" name="txtEmail" id="EmailTextBox" value="<?php echo $_POST['txtEmail'];?>" />
<input name="BtnSubmit" type="submit" onclick="MM_validateForm('NameTextBox','','R','EmailTextBox','','R');return document.MM_returnValue" value="Send" />
</form>
</body>
</html>
Run Code Online (Sandbox Code Playgroud)
提交表格后如何保留复选框.?
创建了一个循环进度条,它与动画一起正常工作.但在尝试使用动态数据显示它时,进度条不会更新.
下面的代码工作正常
progrssBarObj = FindViewById<ProgressBar>(Resource.Id.progressBarSync);
ObjectAnimator animation = ObjectAnimator.OfInt(progrssBarObj, "progress", 0, 100); // see this max value coming back here, we animale towards that value
animation.SetDuration(3000); //in milliseconds
animation.SetInterpolator(new DecelerateInterpolator());
animation.Start();
Run Code Online (Sandbox Code Playgroud)
和AXML代码是
<ProgressBar
style="?android:attr/progressBarStyleHorizontal"
android:layout_column="2"
android:id="@+id/progressBarSync"
android:layout_width="300dp"
android:layout_height="300dp"
android:progressDrawable="@drawable/circular_progress_bar"
android:background="@drawable/progress_bar_background" />
Run Code Online (Sandbox Code Playgroud)
但是当我在循环中尝试类似的东西时,进度条没有更新数据.基本上进度条没有在圆圈中更新.
for (int i = 0; i <= 100; i++)
{
int cnt = 0;
cnt = cnt + i;
progrssBarObj.Progress = cnt;
}
Run Code Online (Sandbox Code Playgroud)
任何帮助将不胜感激.
我有一个名为的xml文件 BackupManager.xml
<?xml version="1.0" encoding="utf-8" ?>
<configuration>
<Settings>
<directory id="backUpPath" value="D:/BACKUPS/"></directory>
<filename id="feilname" value="SameName"></filename>
<period id ="period" value="15"></period>
</Settings>
</configuration>
Run Code Online (Sandbox Code Playgroud)
我试图从标签中获取值到字符串例如: - 我需要'backUpPath'标签的值为'D:/ BACKUPS /'到字符串说'str'
我试过的代码是
XmlDocument infodoc = new XmlDocument();
infodoc.Load("BackupManager.xml");
//int col = infodoc.GetElementsByTagName("directory").Count;
String str = infodoc.GetElementByID("directory").value;
Run Code Online (Sandbox Code Playgroud)
但我在'str'上得到零值
嗨,我需要跳过可能包含文本的行
示例:我有表格OUTSTANDING,下面给出了我的字段.
INVOICENO
AB1
111
ZX3
Run Code Online (Sandbox Code Playgroud)
我需要跳过行包含AB1与ZX3和选择包含行111
我试过这个查询
"SELECT * FROM [INT]..OUTSTANDING WHERE INVOICENO NOT LIKE '%[a-z,-]%'";
Run Code Online (Sandbox Code Playgroud) 我正在尝试使用 Xamarin 原生 android 从蓝牙打印机 (INTERMEC PB51) 打印。
我已经根据以下链接编写了代码。
我的代码如下。
private static byte[] SELECT_BIT_IMAGE_MODE = { 0x1B, 0x2A, 33, (byte)255, 0 };
Run Code Online (Sandbox Code Playgroud)
制作位图如下。
Bitmap sigImage = BitmapFactory.DecodeResource(Resources, Resource.Drawable.icn_logo_jpg);
Run Code Online (Sandbox Code Playgroud)
创建蓝牙插座。
BluetoothSocket socket = null;
BufferedReader inReader = null;
BufferedWriter outReader = null;
string bt_printer = address; //AdminSettings.PrinterMACAddr;
if (string.IsNullOrEmpty(bt_printer)) bt_printer = "00:13:7B:49:D1:8C";
BluetoothDevice mmDevice = BluetoothAdapter.DefaultAdapter.GetRemoteDevice(bt_printer);
UUID applicationUUID = UUID.FromString("00001101-0000-1000-8000-00805F9B34FB");
socket = mmDevice.CreateRfcommSocketToServiceRecord(applicationUUID);
socket.Connect();
Run Code Online (Sandbox Code Playgroud)
调用方式
PrintImage(bitMap, socket);
Run Code Online (Sandbox Code Playgroud)
创建打印方法
public void PrintImage(Bitmap bitmap, BluetoothSocket _socket)
{
try
{
if …Run Code Online (Sandbox Code Playgroud) 可能重复:
如何检测JavaScript是否被禁用?
在我的php应用程序中,我需要检查javascript是否在浏览器中打开.我试过这个<noscript><p>javascript is off<p></noscript>工作正常.但是我需要重定向到一个页面,如果javascript是OFF这样开发
<noscript>
<?php header('Location: index.php');?>
</noscript>
Run Code Online (Sandbox Code Playgroud)
但是i/ts总是重定向到index.php,有任何办法可以做到这一点.
我想检查当前年份是否大于日期字符串(DMY),这是我的代码
$OldDate = "09-30-2011";
$OldYear = strtok($OldDate, '-');
$NewYear = date("Y");
if ($OldYear < $NewYear) {
echo "Year is less than current year"
} else {
echo "Year is greater than current year";
}
Run Code Online (Sandbox Code Playgroud) 我正在尝试从List创建一个字符串
这是我的代码
List<string> SelectedSalesmen = new List<string>();
Run Code Online (Sandbox Code Playgroud)
我正在从列表框中添加选定的销售人员
foreach (ListItem lst in lstBoxSalesmen.Items)
{
if (lst.Selected)
{
SelectedSalesmen.Add(lst.Value);
}
}
Run Code Online (Sandbox Code Playgroud)
最后我将该值存储到这样的字符串中
string SalesManCode = string.Join(",", SelectedSalesmen.ToArray());
Run Code Online (Sandbox Code Playgroud)
但我会这样
SLM001,SLM002,SLM003
Run Code Online (Sandbox Code Playgroud)
但我需要像这样的输出
'SLM001','SLM002','SLM003'
Run Code Online (Sandbox Code Playgroud) 嗨,我在<ul>标签内有一个链接我试图获取类中所有<a>标签的click事件pagination.这个代码
<ul class='pagination'>
<li class='details'>Page 1 of 2</li>
<li><a class='current'>1</a></li>
<li><a href='?page=2'>2</a></li>
<li><a href='?page=2'>Next</a></li>
<li><a href='?page=2'>Last</a></li>
</ul>
Run Code Online (Sandbox Code Playgroud)
我试过的是:
<script>
$(document).ready(function() {
$("a.pagination").click(function(){alert("something..")})
});
</script>
Run Code Online (Sandbox Code Playgroud) 我试图将VB.NET代码转换为C#代码.
这是我的VB.NET代码:
Dim Part1 As String = "Some string"
Dim p_str As String
For I = 1 To Len(Part1)
p_str = Chr(Asc(Mid$(Part1, I, 1)) + 17)
Next
Run Code Online (Sandbox Code Playgroud)
我把它翻译成C#就像这样:
string Part1 = "Some string";
string p_str = null;
for (I = 0; I <= Part1.Length - 1; I++)
{
p_str = Convert.ToChar((Part1.IndexOf(Part1.Substring(I, 1)) + 65) + 17).ToString();
}
Run Code Online (Sandbox Code Playgroud)
谁能告诉我这是否正确?