Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

Make change of sheet view public #489

Closed
Bykiev opened this issue Dec 23, 2020 · 2 comments
Closed

Make change of sheet view public #489

Bykiev opened this issue Dec 23, 2020 · 2 comments

Comments

@Bykiev
Copy link
Collaborator

Bykiev commented Dec 23, 2020

Hi,

I need to change sheet view to pageBreak, but because GetCTWorksheet is internal now it can set only via reflection. Please, make it public.

@tonyqus
Copy link
Member

tonyqus commented Apr 17, 2021

Is this what you want? XSSFSheet.Autobreaks

public bool Autobreaks

@Bykiev
Copy link
Collaborator Author

Bykiev commented Jun 13, 2021

Is this what you want? XSSFSheet.Autobreaks

public bool Autobreaks

No, XSSFSheet.GetCTWorksheet.

/**
* Provide access to the CT_Worksheet bean holding this sheet's data
*
* @return the CT_Worksheet bean holding this sheet's data
*/
internal CT_Worksheet GetCTWorksheet()
{
return this.worksheet;
}

Right now I need to use reflection:

MethodInfo methodInfo = sheet.GetType().GetMethod("GetCTWorksheet", BindingFlags.NonPublic | BindingFlags.Instance);
var ct = (CT_Worksheet)methodInfo.Invoke(sheet, new object[] { });

CT_SheetView view = ct.sheetViews.GetSheetViewArray(0);
view.view = ST_SheetViewType.pageBreakPreview;

@tonyqus tonyqus added this to the NPOI 2.5.5 milestone Jun 13, 2021
@tonyqus tonyqus modified the milestones: NPOI 2.5.5, NPOI 2.5.4 Jul 27, 2021
tonyqus added a commit that referenced this issue Jul 29, 2021
#489 in 2.5.4 branch
# for free to join this conversation on GitHub. Already have an account? # to comment
Projects
None yet
Development

No branches or pull requests

2 participants