cells

C# Accessing EXCEL, formatting cell as General

你说的曾经没有我的故事 提交于 2019-12-06 11:51:22
问题 C#, Visual studio 2010 When manipulating excel cells in C# (via an COM object), should I use the .Value or .Value2 ? that is sheet.Cells[row + n, col].Value = "Hello world" or sheet.Cells[row + n, col].Value2 = "Hello world" What is the difference between them to ? Also, how do I set a cell format to "General" ? sheet.Cells[row + n, col].NumberFormat = "XYZ"; // Not sure what should be here Right now when I assign a cell with the number "0,34" and even if I do sheet.Cells[row + n, col]

Apache POI & colors

落花浮王杯 提交于 2019-12-06 11:31:23
问题 I've some problems with Apache POI, some help would be nice!! I would like to remove the colors in a subpart of an Excel sheet. To do so, the first thing I tried is to render the cells I want to clean (let say the one of the first row only) and to set their color to white: cell.getCellStyle().setFillForegroundColor(IndexedColors.WHITE.index); But if i do that, the color of some cells that are not rendered (let say the one of the second row) are also changed to white cells. It's strange,

Mvc导入

早过忘川 提交于 2019-12-06 10:12:56
[HttpPost] public void Import() { //获取文件 HttpPostedFileBase fileBase = Request.Files["file"]; if(fileBase==null) { Response.Write(""); } //转数据流 Stream stream = fileBase.InputStream; IWorkbook workbook = null; if (Path.GetExtension(fileBase.FileName).ToLower().Equals(".xls")) { workbook = new HSSFWorkbook(stream); } //获取sheet ISheet sheet = workbook.GetSheetAt(0); //获取头 IRow row = sheet.GetRow(0); //定义datatable DataTable dt = new DataTable(); foreach (ICell item in row.Cells) { //循环添加表头 dt.Columns.Add(item.StringCellValue); } for (int i = 0; i <= sheet.LastRowNum; i++) { DataRow dr = dt.NewRow(

How to properly tesselate a image of cells using matlab?

喜夏-厌秋 提交于 2019-12-06 09:43:24
I have the following picture which is a photo of pancreatic cells What I would like to do is being able to get the membrane of each cell (red filament) and then do a tessellation in order to get an idea of the length of a filament. So far I have tried to use the example given on the matlab website but the result is not really good... I = imread('picture.tiff'); I_gray = rgb2gray(I); [~, threshold] = edge(I_gray, 'sobel'); fudgeFactor = .5; BWs = edge(I_gray,'sobel', threshold * fudgeFactor); se90 = strel('line', 3, 90); se0 = strel('line', 3, 0); BWsdil = imdilate(BWs, [se90 se0]); I have been

Equivalent of Fieldnames function for cells

故事扮演 提交于 2019-12-06 05:23:20
As the title says, just wondering if there is a function that works as fieldnames (http://www.mathworks.co.uk/help/matlab/ref/fieldnames.html) does, but for cells. So if I have something like: a = imread('redsquare.bmp'); b = imread('bluesquare.bmp'); c = imread('yellowsquare.bmp'); d = imread('greysquare.bmp'); e = {a, b, c, d}; I'm trying to retrieve either: a, b, c, d OR the image name without the extension. I have tried fn = fileparts(e) and fntemp = cell2struct(e,2) , but I can't get it working. Hope this makes sense Thanks The cell array does not include any meta-information, like field

Getting neighboring cells information using android Samsung galaxy smartphones

无人久伴 提交于 2019-12-06 00:24:33
My target is to get all neighboring cell towers information like cell id, cell lac and RSS values, I used the class telephonyManager.getNeighboringCellInfo() to get required information but it return null every time. But, I succeeded to get the nearest single cell tower information which connected to mobile (i.e serving cell) using telephonyManager.getCellLocation() . I tried to fix this problem and searched on every thing related it, then we found that all samsung devices can not support telephonyManager.getNeighboringCellInfo() class and it does not apply on Samsung but its working on HTC

Apache POI merge cells from a table in a Word document

好久不见. 提交于 2019-12-05 19:15:45
I need to have a table with the cells on the first and second row merged. Something like this: Image of table (I can't post pics) http://i.stack.imgur.com/dAO6j.png I have been reviewing all the questions related to this topic and I have found some answers for applying grid span to the cells, but I couldn't find a real solution. Here is the code I have from examples obtained from google and from this site: XWPFDocument document = new XWPFDocument(); XWPFTable table = document.createTable(7, 2); fillTable(table); XWPFTableCell cellRow1 = table.getRow(0).getCell(0); XWPFTableCell cellRow2 =

Concatenate subcells through one dimension of a cell array without using loops in MATLAB

女生的网名这么多〃 提交于 2019-12-05 12:08:29
I have a cell array. Each cell contains a vector of variable length. For example: example_cell_array=cellfun(@(x)x.*rand([length(x),1]),cellfun(@(x)ones(x,1), num2cell(ceil(10.*rand([7,4]))), 'UniformOutput', false), 'UniformOutput', false) I need to concatenate the contents of the cells down through one dimension then perform an operation on each concatenated vector generating scalar for each column in my cell array (like sum() for example - the actual operation is complex, time consuming, and not naturally vectorisable - especially for diffent length vecotrs). I can do this with loops easily

Adding Different DataGridView Cell Types to a Column

淺唱寂寞╮ 提交于 2019-12-05 02:00:07
问题 Goal My datagridview has two columns ([Question], [Answer]). Depending on the known question type ( Yes/No Checkbox , Text Textbox , FileUpload Button ) I want the column cell to have the respective control . Example Datagridview Rows: [Question] Do you smoke? [Answer] ( YesNo Checkbox ) [Question] How old are you? [Answer] ( Text Textbox ) [Question] Document upload [Answer] ( FileUpload Button ) Work I programmatically create my datagridviews. Private Sub FormatQuestionDgv(ByVal dgv As

aspose.cells导出Demo

霸气de小男生 提交于 2019-12-04 23:45:38
/// <summary> /// 导出excel /// </summary> /// <param name="list"></param> private void ExportExcel(IList<CV_SaaS_POM_ProductionOrder> list) { try { SaveFileDialog Dialog = new SaveFileDialog(); Dialog.Filter = "Excel文件(*.xlsx)|*.xlsx|Excel文件(*.xls)|*.xls"; Dialog.FileName = "SAP生产工单_" + DateTime.Now.ToString("MMdd") + ".xlsx"; if (Dialog.ShowDialog() == DialogResult.OK) { Workbook workbook = new Workbook(); //工作簿 Worksheet sheet = workbook.Worksheets[0]; //工作表 Cells cells = sheet.Cells;//单元格 #region 文字样式 Style style = new Style(); style.HorizontalAlignment = TextAlignmentType.Center;//文字居中