我有一张用Epplus生成的excel表,我遇到了一些痛点,我希望由一个解决了类似挑战的人指导.我需要将数字格式应用于double值,我想在excel中将它呈现为这样.
这是我的代码
ws.Cells[row, col].Style.Numberformat.Format = "##0.0";
Run Code Online (Sandbox Code Playgroud)
最终的excel文件总是将E + 0附加到此格式的末尾,因此会显示最终值.
当我检查生成的Excel工作表的格式单元格时,我看到我的格式显示为## 0.0E + 2而不是我应用的## 0.0.可能有什么不对?
我在Bootstrap 4中的自定义文件输入类有问题.在我选择了要上传的文件后,文件名不显示.
我用这个代码:
<div class="input-group mb-3">
<div class="custom-file">
<input type="file" class="custom-file-input" id="inputGroupFile02">
<label class="custom-file-label" for="inputGroupFile02">Choose file</label>
</div>
<div class="input-group-append">
<button class="btn btn-primary">Upload</button>
</div>
</div>
Run Code Online (Sandbox Code Playgroud)
知道如何解决它而不会太复杂吗?
我目前正在处理一个Excel文件,该文件包含具有我不需要的信息的前导行.这些额外的行也会导致在下面的标题行中导入该数据.所以我试图删除它们来处理数据.
using (var pack = new ExcelPackage(myFileInfo))
{
// Should return the sheet name
var ws = pack.Workbook.Worksheets.FirstOrDefault();
// Should Delete rows 1-5 and shift up the rows after deletion
ws.DeleteRow(1,5,true);
}
Run Code Online (Sandbox Code Playgroud)
我认为上面的东西会起作用,但我没有取得多大成功.
目标是删除行1-5,向上移动其余数据(可能合并会起作用吗?)然后将其转换为数据表.
任何人都有关于从我的Excel工作表中删除行的提示提示或资源(在将其移入数据表之前,因为这是问题发生的地方)
我在sharepoint事件接收器中有以下代码,用于将.oft文件复制到文档库中并将其粘贴到新目标(另一个文档库)中: -
SPDocumentLibrary template = (SPDocumentLibrary)properties.Web.GetList(properties.Web.ServerRelativeUrl + "/Templates/");
SPListItem templetefile = null;
foreach (SPListItem i in template.Items)
{
if (i.Name.ToLower().Contains("project"))
{
templetefile = i;
}
}
byte[] fileBytes = templetefile.File.OpenBinary();
string destUrl = properties.Web.ServerRelativeUrl + "/" + projectid.RootFolder.Url +".oft";
SPFile destFile = projectid.RootFolder.Files.Add(destUrl, fileBytes, false);
Run Code Online (Sandbox Code Playgroud)
现在我的代码运行良好.但我不确定我是否可以在复制后访问.OFT文件,并修改其主题(按主题我的意思是我的电子邮件主题)?
我想增加计时器刻度事件的值,但它没有增加不知道我忘了它只显示1.
<asp:Timer ID="Timer1" runat="server" OnTick="Timer1_Tick" Interval="1000"></asp:Timer>
private int i = 0;
protected void Timer1_Tick(object sender, EventArgs e)
{
i++;
Label3.Text = i.ToString();
}
Run Code Online (Sandbox Code Playgroud) 我在我的母版页中有这个.我点击它时可以突出显示菜单,但是当网站打开并开始加载页面时,我无法突出显示网站的开始页面.输入是我的开始页面.
编辑:我在帖子后面看到了亮点消失了.我该怎样预防呢?
<script type="text/javascript">
$(document).ready(function () {
var url = window.location;
$('.navbar .nav').find('.active').removeClass('active');
$('.navbar .nav li a').each(function () {
if (this.href == url) {
$(this).parent().addClass('active');
}
});
});
</script>
<nav class="navbar navbar-default" style="margin-bottom: -20rem; clear: none; background-color: white; border-color: white;">
<div style="margin-left: 0px;">
<div class="navbar-header">
<img src="../../Images/_logo.png" width="130" height="40" style="margin-right: 30px;" />
</div>
<div id="myNavbar">
<ul class="nav navbar-nav" id="menusite">
<li class="active"><a id="A1" style="outline: 0;" href="<%= Page.ResolveUrl("~/Pages/Entry")%>" title="Entry">Entry</a></li>
<li><a id="A7" style="outline: 0;" href="<%= Page.ResolveUrl("~/Pages/Ideation")%>" title="Ideation">Ideation</a></li>
<li><a id="A3" style="outline: 0;" href="<%= Page.ResolveUrl("~/Pages/Search")%>" …Run Code Online (Sandbox Code Playgroud) 我在 .net core Web api 中使用 EPPlus 库。在上述方法中我想验证他上传的Excel。我想知道我的整行是否为空。我有以下代码:
using (ExcelPackage package = new ExcelPackage(file.OpenReadStream()))
{
ExcelWorksheet worksheet = package.Workbook.Worksheets[1];
int rowCount = worksheet.Dimension.End.Row;
int colCount = worksheet.Dimension.End.Column;
//loop through rows and columns
for (int row = 1; row <= rowCount; row++)
{
for (int col = 1; col <= ColCount; col++)
{
var rowValue = worksheet.Cells[row, col].Value;
//Want to find here if the entire row is empty
}
}
}
Run Code Online (Sandbox Code Playgroud)
上面的 rowValue 会告诉我特定单元格是否为空。是否可以检查整行,如果为空则继续到下一行。
我有一个产品页面.我想将我的产品添加到我的数据库中,我也想更新我的产品.我的图像有问题.当我插入产品时,可以正常使用..在我的aspx页面中,我有以下代码:
<span>
<asp:FileUpload ID="files" runat="server" AllowMultiple="true" />
</span>
<div runat="server" id="previewImages"></div>
Run Code Online (Sandbox Code Playgroud)
当我保存我的产品时,在代码后面我有这个代码:
string filenm = string.Empty;
HttpFileCollection fileCollection = Request.Files;
for (int i = 0; i < fileCollection.Count; i++)
{
HttpPostedFile uploadfile = fileCollection[i];
if (uploadfile.ContentLength > 0)
{
string filename = uploadfile.FileName;
System.IO.Directory.CreateDirectory(Server.MapPath("immScarpe/" + txtStyle.Text));
file.SaveAs(Server.MapPath("immScarpe/" + txtStyle.Text + "/") + fileName);
//this is pseudo-code
INSERT INTO PRODUCT_IMM (IdProduct, Path) VALUES (Id, "immScarpe/" + txtStyle.Text + "/" + fileName)
}
}
Run Code Online (Sandbox Code Playgroud)
现在,问题是我可以编辑保存的产品.当我单击产品的编辑按钮时,我必须加载它的所有数据并让用户修改它们.还有图像.
主要问题是:如何在asp:FileUpload控件中加载保存的图像?
我想做的另一件事是在插入和编辑中显示图像预览...
但是,如果只有一个FileUpload可以使用AllowMultiple = true
如果有必要,我愿意使用其他技术,如javascript,jquery和Ajax
我正在尝试使用Linq to SQL作为Lambda表达式在2列上进行内部联接。普通查询如下所示。
SELECT * FROM participants
LEFT OUTER JOIN prereg_participants ON prereg_participants.barcode = participants.barcode
AND participants.event_id = prereg_participants.event_id
WHERE (participants.event_id = 123)
Run Code Online (Sandbox Code Playgroud)
我成功地在左列上使用以下代码进行了联接。
var dnrs = context.participants.GroupJoin(
context.prereg_participants,
x => x.barcode,
y => y.barcode,
(x, y) => new { deelnr = x, vi = y })
.SelectMany(
x => x.vi.DefaultIfEmpty(),
(x, y) => new { deelnr = x, vi = y })
.Where(x => x.deelnr.deelnr.event_id == 123)
.ToList();
Run Code Online (Sandbox Code Playgroud)
问题在于,使用上述Lambda时,我得到了太多结果,因为它缺少AND participants.event_id = prereg_participants.event_id零件。但是,无论我怎么努力,我都没有得到正确数量的参与者。
我查看了以下现有问题,但是在编写正确的lambda时没有一个解决了我的问题。而且大多数解决方案都是lambda格式的nog或不是多列上的Left外部联接。
我正在尝试使用从 csv 读取的一些数据运行 tensorflow DNNClassifier 模型。即使我将每列的数据类型转换为 float32,我仍然得到 'DataFrame' 对象没有属性 'dtype' 错误。如果您能帮助我,我将不胜感激。
数据格式:27 列,23 个输入,4 个类
谢谢
import numpy as np
import pandas as pd
import tensorflow as tf
import matplotlib.pyplot as plt
%matplotlib inline
factors = pd.read_csv('xxx.csv')
#Formatting data to float32
factors['1'] = factors['1'].astype('float32')
factors['2'] = factors['2'].astype('float32')
...
factors['27'] = factors['27'].astype('float32')
#Definition of in- and output
feat_data = factors[['1', '2', ... '23']]
labels = factors[['24', '25','26', '27']]
#Train-Test Split
from sklearn.model_selection import train_test_split
X_train, X_test, y_train, y_test = train_test_split(feat_data,labels, test_size=0.3, …Run Code Online (Sandbox Code Playgroud) c# ×7
asp.net ×6
epplus ×3
excel ×3
file-upload ×2
html ×2
jquery ×2
.net ×1
ajax ×1
bootstrap-4 ×1
css ×1
html5 ×1
lambda ×1
linq-to-sql ×1
python ×1
sql-server ×1
tensorflow ×1