여기 내 문제는 짧습니다. 나는 그것이 우리의 porpus에 적합한 지 아닌지 알아 내기 위해 OfficeWriter의 데모 버전을 사용하고 있습니다. 특히 4 개의 DataTable의 X-Y 열을 나타내는 8 개의 자리 표시 자로 구성된 Excel 템플릿과 Excel에서 열을 다시 나타내는 열 쌍을 참조하여 4 개의 시리즈를 추가하는 Excel 분산 형 차트를 준비했습니다. 내 코드에서이 템플릿을 목록의 항목에 따라 여러 번 복사하고 항목 이름 뒤에 복사 한 시트의 이름을 지정합니다 (이 경우 wb.CopySheet (...) 메서드 사용). 여기서 주요 문제는 "xlt.process()"메서드를 호출 할 때 Y- 범위 데이터 마커를 올바른 시트 이름으로 올바르게 업데이트하지만 X- 범위 데이터 마커를 업데이트하지 않는 것입니다. 누군가 내게 손을 줄 수 있습니까?DataTable을 Excel 템플릿 시트에 바인딩 한 후 DataTable 자리 표시 자 위에 Excel 분산 형 차트를 작성하려면 어떻게해야합니까?
답변
이 버그가 나타납니다. OfficeWriter가 차트의 값을 읽을 때 .ScatterValues 속성이 올바른 범위 값 (예 : = Sheet2! $ R $ 2 : $ R $ 2)으로 설정되어 CopySheet가 실패하게됩니다. 이 버그를 수정하기 위해 개발 용 버그를 제출했습니다. 내가 SoftArtisans 작동, OfficeWriter의 업체 :
string templatePath = "input.xlsx";
/* Open the template workbook */
ExcelApplication xla = new ExcelApplication();
var wb = xla.Open(templatePath);
/* Select the template worksheet to copy */
var origWS = wb.Worksheets["Sheet1"];
/* Make a copy of the worksheet with the given name */
var wsName = "Sheet2";
wb.Worksheets.CopySheet(origWS, 1, wsName);
/* For the new worksheet, update the ScatterValues to point to this sheet */
var newWS = wb.Worksheets[wsName];
newWS.Charts[0].SeriesCollection[0].ScatterValues = "=" + wsName + "!$B$27";
/* Create an instance of ExcelTemplate */
ExcelTemplate xlt = new ExcelTemplate();
/* Open the workbook from the ExcelApplication object above */
xlt.Open(xla, wb);
면책 조항 :
당신이 .ScatterValues 위의 코드에서 ( http://wiki.softartisans.com/display/EW8/Series.ScatterValues 참조) 속성을 설정할 수 있습니다,이 문제를 해결하려면.정말 고마워, 나는 실제로 그것이 버그라고 느끼고 있었지만 대답과 해결 방법을 제안 해 주셔서 감사합니다. 당신은 곧 그것을 고쳐 줄 것이라고 생각합니까? – user2324645
내 이전 의견 수정 :이 문제는 개발팀에 전달되어 처리되었습니다. 그들이 일정을 정할 때 결정되지 않았습니다. 원하는 경우 SoftArtisans (http://www.softartisans.com/contact-softartisans)에 직접 문의 할 수 있으며 팀에서이 문제를 직접 해결하도록 도울 수 있습니다. 이 게시물을 언급하면 올바르게 라우팅됩니다. –
나는 OfficeWriter 사랑 (면책 조항 : 나는 OfficeWriter에 개발자입니다) 나는 설정에 대한 빠른 샘플 수 있었다 달성이 :
using System; using System.Data; using SoftArtisans.OfficeWriter.ExcelWriter;
namespace ExcelTemplateScatterChart {
class Program
{
static void Main(string[] args)
{
/* Create an instance of ExcelTemplate */
ExcelTemplate xlt = new ExcelTemplate();
/* Open the template workbook */
string templatePath = "input.xlsx";
xlt.Open(templatePath);
/* Query the database for report data */
DataTable dt1 = GetTable1();
DataTable dt2 = GetTable2();
/* Pass the DataTable to ExcelTemplate */
xlt.BindData(dt1, "DataTable1", xlt.CreateDataBindingProperties());
xlt.BindData(dt2, "DataTable2", xlt.CreateDataBindingProperties());
/* Call the process() method to populate the
* template with the data source values
*/
xlt.Process();
/* Save the report by streaming it
* to the client's browser */
xlt.Save("output.xlsx");
}
/// <summary>
/// This example method generates a DataTable.
/// </summary>
static DataTable GetTable1()
{
//
// Here we create a DataTable with four columns.
//
DataTable table = new DataTable();
table.Columns.Add("x", typeof(int));
table.Columns.Add("y", typeof(int));
//
// Here we add three DataRows.
//
table.Rows.Add(1, 10);
table.Rows.Add(2, 20);
table.Rows.Add(3, 30);
return table;
}
/// <summary>
/// This example method generates a DataTable.
/// </summary>
static DataTable GetTable2()
{
//
// Here we create a DataTable with four columns.
//
DataTable table = new DataTable();
table.Columns.Add("x", typeof(int));
table.Columns.Add("y", typeof(int));
//
// Here we add three DataRows.
//
table.Rows.Add(1, 30);
table.Rows.Add(2, 20);
table.Rows.Add(3, 10);
return table;
}
} }
내가 설정 내 템플릿 : 다음 코드를 사용하여
같은 :
그리고는 datamarkers/장소 홀더를 가리 키도록 차트를 구성 같은
결과 출력은 내 코드를 실행 한 후 다음 무엇을 :
는에서 찾을 수 있습니다. 제 질문에 충분히 명확하지 않은 경우 사과드립니다. 설득력있는 설명을 할 시간이 없었습니다. 스크린 샷. 나는 나의 질문을 더 자세히 묘사했다. – user2324645
- 1. Excel 2010 동일한 데이터에서 여러 분산 형 차트를 만드는 방법
- 2. OpenTBS를 사용한 샘플 분산 형 Excel 차트
- 3. ClosedXML. 기존 Excel 워크 시트에 DataTable 추가
- 4. 이미 존재하는 Excel 시트의 한 시트에 파이썬으로 작성하려면 어떻게합니까?
- 5. Excel 차트를 Html 페이지에 표시
- 6. Excel : 분산 형 플롯에 여러 계열을 그려야합니다.
- 7. 라이브러리 클래스의 열거 형 자리 표시 자
- 8. DataTable을 Excel 파일로 내보내기 asp.net
- 9. 다트 템플릿 및 클릭당 {{}} 자리 표시 자
- 10. Excel 통합 문서 (VS Excel 2010 통합 문서 프로젝트)에 DataTable을 삽입 (바인딩)하는 방법
- 11. Excel 조건부 서식 - 다른 시트에 일부만 표시
- 12. Excel 시트에 DSN을 지정하지 않고 jdbc를 사용하여 Excel 시트에 연결
- 13. open xml excel 자리 표시 자에 실제 값 삽입
- 14. Excel VBA - 스프레드 시트에 데이터를 추가 한 후 수식이 끊어짐
- 15. Excel 시트에 C#
- 16. Excel 스프레드 시트에 오류로드
- 17. Excel 템플릿에서 Excel 차트를 생성하는 방법은 무엇입니까?
- 18. Datatable : Excel 내보내기 단추
- 19. 자리 표시 자 HTML5가
- 20. 독립 실행 형 Excel 매크로
- 21. 자리 표시 자
- 22. 빈 슬라이더 자리 표시 자
- 23. Select2 생성 후 자리 표시 자 추가
- 24. 장고 자리 표시 자
- 25. TinyMCE에 자리 표시 자 텍스트를 추가하려면 어떻게해야합니까?
- 26. Excel 시트에 데이터를 삽입하는 방법
- 27. 전체 시트를 Excel 시트에 표시하는 방법은 무엇입니까?
- 28. 데이터 테이블에서 Excel 시트에 데이터 삽입
- 29. ino_t의 자리 표시 자
- 30. IE의 자리 표시 자
사용중인 코드를 게시 할 수 있습니까? –
Excel 템플릿을 사용하여 차트 생성을위한 OfficeWriter 자습서를 체크 아웃 할 수도 있습니다. 또한 샘플 코드도 있습니다. 이것은 http://wiki.softartisans.com/display/EW8/Using+Charts+with+ExcelTemplate –