小编alt*_*gan的帖子

从excel文件中打开xml

我想在我的项目中实现openXml sdk 2.5.我在这个链接中做了一切

using DocumentFormat.OpenXml;
using DocumentFormat.OpenXml.Packaging;
using DocumentFormat.OpenXml.Spreadsheet;
using System.IO.Packaging;


static void Main(string[] args)
        {

            String fileName = @"C:\OPENXML\BigData.xlsx";
            // Comment one of the following lines to test the method separately.
            ReadExcelFileDOM(fileName);    // DOM
            //ReadExcelFileSAX(fileName);    // SAX
        }

        // The DOM approach.
        // Note that the code below works only for cells that contain numeric values.
        // 
        static void ReadExcelFileDOM(string fileName)
        {
            using (SpreadsheetDocument spreadsheetDocument = SpreadsheetDocument.Open(fileName, false))
            {
                WorkbookPart workbookPart = spreadsheetDocument.WorkbookPart;
                WorksheetPart worksheetPart = workbookPart.WorksheetParts.First(); …
Run Code Online (Sandbox Code Playgroud)

c# excel openxml-sdk

21
推荐指数
3
解决办法
8万
查看次数

如何在asp.net用户控件中使用jQuery ajax?

我想在asp.net用户控件中使用ajax,

    $.ajax({
        type: "POST",
        url: "*TCSection.ascx/InsertTCSection",
        data: "{id:'" + id + "'}",
        contentType: "application/json; charset=utf-8",
        dataType: "json",
        success: function (msg) {
            var URL = msg.d;
            alert(URL);
        });
Run Code Online (Sandbox Code Playgroud)

.cs代码

[WebMethod]
public static string InsertTCSection(string id)
{
    string result = "deneme";
    return result; 
}
Run Code Online (Sandbox Code Playgroud)

asp.net ajax jquery

6
推荐指数
2
解决办法
1万
查看次数

Excel工作表用c#选择第一行

我想使用interop对象选择excel sheet第一行.我能怎么做 ?

xlWorkBook = xlApp.Workbooks.Open(directory, 0, true, 5, "", "", true, Microsoft.Office.Interop.Excel.XlPlatform.xlWindows, "\t", false, false, 0, true, 1, 0);
xlWorkSheet = (Excel.Worksheet)xlWorkBook.Worksheets.get_Item(1);
range = xlWorkSheet.UsedRange;
var List<string> tempList= range[1,*].Value.ToList();
Run Code Online (Sandbox Code Playgroud)

我想和abow一样写.我该怎么写这种情况

c# linq excel

5
推荐指数
2
解决办法
1万
查看次数

从asp.net调用控制台应用程序

当我在控制台应用程序中放置断点时为什么它不能停在那里我尝试从asp.net调用控制台应用程序.如何调用控制台应用程序?

 var proc = Process.Start("D:\\Edefter\\EFaturaConsoleTxtParser\\bin\\Debug\\EFaturaConsoleTxtParser.exe", "/arg1 /arg2");
                proc.WaitForExit();
Run Code Online (Sandbox Code Playgroud)

asp.net console-application

4
推荐指数
2
解决办法
9339
查看次数

setInterval(function(),time)在运行时更改时间

我想在代码运行时更改setInterval函数时间.

我试试这个

<script type="text/javascript">
        $(function () {
            var timer;
            function come() { alert("here"); }
            timer = setInterval(come, 0);
            clearInterval(timer);
            timer = setInterval(come, 10000);
        });
    </script>
Run Code Online (Sandbox Code Playgroud)

第一个SetInterval不起作用!

javascript jquery

3
推荐指数
2
解决办法
2万
查看次数

js文件中的jQuery ajax

我正在使用ASP.Net-MVC3,我使用此查询

Layout.cshtml:

$(function() {
    $.ajax({
        url: '@Url.Action("EtiketGetir", "Etiket")',
        type: "POST",
        data: {
            data: data
        },
        success: function(msg) {},
        error: function(msg) {}
    });?
Run Code Online (Sandbox Code Playgroud)

这工作layout.cshtml,但我复制了该代码并粘贴到test.js文件,它停止工作.

asp.net-mvc jquery razor asp.net-mvc-3

2
推荐指数
1
解决办法
2210
查看次数

"T:new()"对泛型有什么意义?

我想了解那段代码.我认为T必须IContinentFactory's实现类,但我不理解结束new()关键字.

class AnimalWorld<T> : IAnimalWorld where T : IContinentFactory, new()
{
.....
}
Run Code Online (Sandbox Code Playgroud)

c# generics

2
推荐指数
2
解决办法
180
查看次数

Concat两个字典具有相同的密钥记录

我想合并两个词典.当我尝试这个时,我得到一个关于重复键的错误.如何合并两个具有相同键的字典?

class Program
{
    static void Main(string[] args)
    {
        Dictionary<Class1.Deneme, List<string>> dict1 = new Dictionary<Class1.Deneme, List<string>>();
        Dictionary<Class1.Deneme, List<string>> dict2 = new Dictionary<Class1.Deneme, List<string>>();
        Dictionary<Class1.Deneme, List<string>> dict3 = new Dictionary<Class1.Deneme, List<string>>();

        List<string> list1 = new List<string>() { "a", "b" };
        List<string> list2 = new List<string>() { "c", "d" };
        List<string> list3 = new List<string>() { "e", "f" };
        List<string> list4 = new List<string>() { "g", "h" };

        dict1.Add(Class1.Deneme.Buyer, list1);
        dict2.Add(Class1.Deneme.Buyer, list2);
        dict3 = dict1.Concat(dict2).ToDictionary(kvp => kvp.Key, kvp => kvp.Value);

        Console.Read();
    } …
Run Code Online (Sandbox Code Playgroud)

c# linq dictionary

2
推荐指数
1
解决办法
1680
查看次数

读取创建的excel(打开xml)时共享字符串表返回null

我正在使用 open xml sdk 创建 excel 文件。我想使用 open xml 阅读它。当我想阅读它时,我在这一行出错
SharedStringTablePart sstpart = workbookPart.GetPartsOfType<SharedStringTablePart>().First();it return null

如果我打开excel文件并再次保存。它会创建共享字符串表并运行。

从excel读取

#region OpenFile
        public void  OpenFile(string directory)
        {
            try
            {
                fs = new FileStream(directory, FileMode.Open, FileAccess.Read, FileShare.ReadWrite);
                doc = SpreadsheetDocument.Open(fs, false);
            }
            catch (FileNotFoundException ex)
            {
                string exception = string.Format("Doya bulunamad?{0}", directory); 
                throw new ApplicationException(exception);
            }
        }
        #endregion

        #region GetWorkSheet
        public void AssignWorkSheet(int sheetID)
        {
            if (fs == null || doc == null)
                throw new ApplicationException("Dosya aç?lamad?");

            WorkbookPart workbookPart = doc.WorkbookPart;
            SharedStringTablePart sstpart …
Run Code Online (Sandbox Code Playgroud)

c# openxml openxml-sdk

2
推荐指数
1
解决办法
6067
查看次数

浏览器的上一个或下一个按钮控件

我想使用jQuery访问浏览器上一个或下一个按钮.当我点击浏览器上一个按钮我想看到警报("是"); 或任何回应.这可能吗?

javascript jquery

1
推荐指数
1
解决办法
1055
查看次数

C#中的对象更改

当我写这段代码时,我发现一个意想不到的情况如何才能解决这个问题?

KurumReferans tempReferans = new KurumReferans();
tempReferans = kRef; 

if (kurumDetaylari.IsTakipMekanizmasiKullaniyor == true)
{
    KurumReferans kRefIstakip = new KurumReferans();
    kRefIstakip = kRef;
    kRefIstakip.Referans = "SORUMLU";
    kRefIstakip.Yontem = "SORUMLU:";
    kRefIstakip.Tipi = Tipi.Zorunlu;
    kRefIstakip.Parent = kurum;
    PostAddEdit(db.KurumReferans, kRefIstakip, cmd, "", "", "", "");
}
Run Code Online (Sandbox Code Playgroud)

首先我分配,

tempReferans = kRef;
Run Code Online (Sandbox Code Playgroud)

当我分配kref给其他对象后,

KurumReferans kRefIstakip = new KurumReferans();
kRefIstakip = kRef;
kRefIstakip.Referans = "SORUMLU";
Run Code Online (Sandbox Code Playgroud)

tempReferans 对象的值会发生变化,但我想要旧的值.

c# oop object

0
推荐指数
1
解决办法
94
查看次数

C#文件目录树

任何人都可以向我解释这是什么意思,我想移动一个文件夹

 ../
 ./
 /
 ~
Run Code Online (Sandbox Code Playgroud)

例如

Server.MapPath("../deneme.txt"); 对于将目录移动到父目录,此代码是否为true

c# file

0
推荐指数
1
解决办法
110
查看次数