Solved

Problem to adjust sheet

Posted on 2016-07-31
1
88 Views
Last Modified: 2016-08-22
Hi,
How to adjust these
    Using (SpreadsheetDocument spreadSheet = SpreadsheetDocument.Open(docName, true))
    {
        SharedStringTablePart shareStringPart;
        if (spreadSheet.WorkbookPart.GetPartsOfType<SharedStringTablePart>().Count() > 0)
        {
            shareStringPart = spreadSheet.WorkbookPart.GetPartsOfType<SharedStringTablePart>().First();
        }
        else
        {
            shareStringPart = spreadSheet.WorkbookPart.AddNewPart<SharedStringTablePart>();
        }

        int index = InsertSharedStringItem(text, shareStringPart);

        WorksheetPart worksheetPart = InsertWorksheet(spreadSheet.WorkbookPart);

        Cell cell = InsertCellInWorksheet("A", 1, worksheetPart);

        cell.CellValue = new CellValue(index.ToString());
        cell.DataType = new EnumValue<CellValues>(CellValues.SharedString);

        worksheetPart.Worksheet.Save();
    }

Open in new window

to put specific value into one cell of a selected sheet with a provided name?
0
Comment
Question by:HuaMinChen
1 Comment
 
LVL 18

Accepted Solution

by:
xtermie earned 500 total points
ID: 41765132
From what I understand you will need to
Set docName = "c:\test.xls"     'specify YOUR DOCUMENT here

Now for the value you have to be more specific
i.e. which cell, are there any conditions, what value etc
0

Featured Post

Master Your Team's Linux and Cloud Stack

Come see why top tech companies like Mailchimp and Media Temple use Linux Academy to build their employee training programs.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

A long time ago (May 2011), I have written an article showing you how to create a DLL using Visual Studio 2005 to be hosted in SQL Server 2005. That was valid at that time and it is still valid if you are still using these versions. You can still re…
This code takes an Excel list of URL’s and adds a header titled “URL List”. It then searches through all URL’s in column “A”, looking for duplicates. When a duplicate is found, it is moved to the top of the list. The duplicate URL’s are then highlig…
This Micro Tutorial demonstrates using Microsoft Excel pivot tables, how to reverse engineer competitors' marketing strategies through backlinks.
With the power of JIRA, there's an unlimited number of ways you can customize it, use it and benefit from it. With that in mind, there's bound to be things that I wasn't able to cover in this course. With this summary we'll look at some places to go…

785 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question