Solved

Problem to adjust sheet

Posted on 2016-07-31
1
94 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
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

Secure Your Active Directory - April 20, 2017

Active Directory plays a critical role in your company’s IT infrastructure and keeping it secure in today’s hacker-infested world is a must.
Microsoft published 300+ pages of guidance, but who has the time, money, and resources to implement? Register now to find an easier way.

Question has a verified solution.

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

This article shows how to deploy dynamic backgrounds to computers depending on the aspect ratio of display
You need to know the location of the Office templates folder, so that when you create new templates, they are saved to that location, and thus are available for selection when creating new documents.  The steps to find the Templates folder path are …
This Micro Tutorial will demonstrate how to create pivot charts out of a data set. I also added a drop-down menu which allows to choose from different categories in the data set and the chart will automatically update.

730 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