我正在尝试使用Puppeteer chrome生成pdf。
pdf中的数据是动态的。
pdf包含我通过遍历数据生成的多个表。
因此,有两个循环,循环表和循环<td>每个表中的数据()。
该表的标题-inside- <thead>具有rowspan。不幸的是,这<thead>并没有打破我的预期。
这是当前情况:
预期结果
我期望的是<thead>不会中断。
如果<thead>不适合,则应转到下一页。
我使用车把创建了模板。
这是模板的代码:
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta http-equiv="X-UA-Compatible" content="ie=edge">
<style>
html,
body {
min-height: 150mm !important;
max-width: 297mm !important;
}
@page {
size: auto;
}
</style>
</head>
<body>
<div>
{{#each array as |data|}}
<table>
<thead style="page-break-inside: avoid !important">
<tr>
<th rowspan="2">
One
</th>
<th rowspan="2">
Two
</th>
<th colspan="2">
Three
</th> …Run Code Online (Sandbox Code Playgroud) 我已经尝试了来自多个资源的几个代码来检测用户是否已经到达页面底部然后获取更多数据。它可以工作,但该函数总是在我滚动时获取数据,而不是在用户到达底部时获取数据。这是我的代码:
import React, { Component } from 'react';
class DataView extends Component {
constructor(props) {
super(props);
this.state = {
displayedData: [],
initialData: [],
loadingState: false,
};
this.fetchMoreData = this.fetchMoreData.bind(this);
this.handleScroll = this.handleScroll.bind(this);
}
componentDidMount() {
window.addEventListener('scroll', this.handleScroll, true);
}
componentWillReceiveProps(props) {
const initialData = props.initialData;
this.setState({
initialData,
displayedData: initialData.slice(0, 3),
});
}
componentWillUnmount() {
window.removeEventListener('scroll', this.handleScroll, true);
}
fetchMoreData() {
console.log('fetch');
this.setState({ loadingState: true });
if (this.state.displayedData.length >= this.state.initialData.length) {
this.setState({
loadingState: false,
});
return;
}
const size = 3; …Run Code Online (Sandbox Code Playgroud) 我有一个现有代码在不同的 PC 上运行,然后我尝试复制它,但不知何故新 PC 中的代码不起作用。它抛出一个异常,ClassCastException。这是引发异常的根方法:
import java.io.BufferedInputStream;
import java.io.File;
import java.io.FileOutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.PreparedStatement;
import java.sql.SQLException;
import java.util.Date;
import java.util.Iterator;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
import javax.xml.parsers.ParserConfigurationException;
import org.apache.poi.openxml4j.opc.OPCPackage;
import org.apache.poi.openxml4j.opc.PackageAccess;
import org.apache.poi.ss.usermodel.Cell;
import org.apache.poi.ss.usermodel.DataFormatter;
import org.apache.poi.ss.usermodel.Row;
import org.apache.poi.ss.usermodel.Sheet;
import org.apache.poi.ss.usermodel.Workbook;
import org.apache.poi.util.SAXHelper;
import org.apache.poi.xssf.eventusermodel.ReadOnlySharedStringsTable;
import org.apache.poi.xssf.eventusermodel.XSSFReader;
import org.apache.poi.xssf.eventusermodel.XSSFSheetXMLHandler;
import org.apache.poi.xssf.model.StylesTable;
import org.apache.poi.xssf.usermodel.XSSFWorkbook;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import org.springframework.web.multipart.MultipartFile;
import org.xml.sax.ContentHandler;
import org.xml.sax.InputSource;
import org.xml.sax.SAXException;
import org.xml.sax.XMLReader;
@Service
public class ExcelServiceImpl implements …Run Code Online (Sandbox Code Playgroud) 我正在使用反应选择,只是注意到当我在输入字段中已经有值时(通过用户类型或通过选择菜单列表中的选项),然后我模糊输入然后再次聚焦它 - 尝试编辑我的最后一个输入 - 它只是从头开始,而不是从输入的最后一个字符继续。我刚刚在作者的github上发现了这个问题。它是两年前提出的,目前仍然是一个悬而未决的问题。真的没有解决方法可以实现这一目标吗?
我正在开发应用程序RN 0.59.8。我正在尝试使用 水平创建可滚动视图ScrollView。这是我的代码的基础(抱歉我无法分享更多细节):
import React, { Component, Fragment } from 'react';
import {
ScrollView,
} from 'react-native';
import {
Container,
Content,
} from 'native-base';
import { Grid, Row } from 'react-native-easy-grid';
import ChildComponent from './ChildComponent';
class MyComponent extends Component {
render() {
const {
data,
} = this.props;
return (
<Container>
<Content>
<Grid>
<Row>
<ScrollView
horizontal
contentContainerStyle={{
flex: 1, flexGrow: 1, flexDirection: 'row',
}}
>
{
data.map((item, index) => {
const order = index;
return ( …Run Code Online (Sandbox Code Playgroud) 规格:
背景:
我正在尝试使用recharts包来创建图表。我已经非常接近我的目标了。但是,如果标签太长,我会坚持设计 YAxis 标签的样式以使其省略。
当前的状况:
正如您所看到的,它与其他数据重叠。我知道我可以减小字体大小或将宽度设置得更大。但是,问题是,YAxis 标签是动态的,并且可能很长。这是当前代码https://codesandbox.io/s/simple-bar-chart-forked-72z60?file=/src/App.tsx
客观的:
我想让 YAxis 标签显示“这是长标签并且...”(如果太长则显示三个点),类似于使用省略号。
顺便说一句,我有与此问题Dynamic height for Recharts Horizontal barchart with long labels in YAxis相同的问题。您可以将其标记为重复,但也请帮助我。这些问题仍然没有得到接受的答案。
我已经完成了获取所有数据并将对象转换为 objectDto。但是,不知何故,我觉得我的代码还不够好。在这里我需要你的帮助,我需要任何参考/建议来使我的代码更好(在性能方面)。这是我的工作代码:
@Override
public List<BookDto> findAll() throws Exception {
try {
List<Book> list = bookDao.findAll();
List<BookDto> listDto = new ArrayList<>();
for (Book book : list) {
BookDto bookDto = new BookDto();
Set<AuthorDto> listAuthorDto = new HashSet<AuthorDto>();
Set<Author> dataAuthor = new HashSet<Author>();
book.getAuthor().iterator().forEachRemaining(dataAuthor::add);
BeanUtils.copyProperties(book, bookDto, "author", "category");
bookDto.setCategory(book.getCategory().getCategory());
for (Author author : dataAuthor) {
AuthorDto authorDto = new AuthorDto();
BeanUtils.copyProperties(author, authorDto);
listAuthorDto.add(authorDto);
}
bookDto.setAuthor(listAuthorDto);
listDto.add(bookDto);
}
return listDto;
} catch (Exception e) {
throw new Exception(e);
}
}
Run Code Online (Sandbox Code Playgroud)
这是我需要的输出(已经用上面的代码实现了):
[
{ …Run Code Online (Sandbox Code Playgroud) reactjs ×3
css ×2
java ×2
dto ×1
entity ×1
html-table ×1
javascript ×1
puppeteer ×1
react-native ×1
react-select ×1
recharts ×1
scrollview ×1
spring ×1
spring-boot ×1